summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_rtalloc.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-08-30 15:37:01 -0700
committerDarrick J. Wong <djwong@kernel.org>2024-09-01 08:58:19 -0700
commit86a0264ef26e90214a5bd74c72fb6e3455403bcf (patch)
tree3bb9aa94948bf5aa33c6f7dd3a7f03f26a57ad5a /fs/xfs/xfs_rtalloc.c
parenta18a69bbec083093c3bfebaec13ce0b4c6b2af7e (diff)
xfs: ensure rtx mask/shift are correct after growfs
When growfs sets an extent size, it doesn't updated the m_rtxblklog and m_rtxblkmask values, which could lead to incorrect usage of them if they were set before and can't be used for the new extent size. Add a xfs_mount_sb_set_rextsize helper that updates the two fields, and also use it when calculating the new RT geometry instead of disabling the optimization there. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/xfs_rtalloc.c')
-rw-r--r--fs/xfs/xfs_rtalloc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index a9f08d96f1fe..4bbb50d5a4b7 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -719,8 +719,8 @@ xfs_growfs_rt_bmblock(
/*
* Calculate new sb and mount fields for this round.
*/
- nmp->m_rtxblklog = -1; /* don't use shift or masking */
nmp->m_sb.sb_rextsize = rextsize;
+ xfs_mount_sb_set_rextsize(nmp, &nmp->m_sb);
nmp->m_sb.sb_rbmblocks = bmbno + 1;
nmp->m_sb.sb_rblocks = min(nrblocks, nrblocks_step);
nmp->m_sb.sb_rextents = xfs_rtb_to_rtx(nmp, nmp->m_sb.sb_rblocks);
@@ -807,10 +807,11 @@ xfs_growfs_rt_bmblock(
xfs_trans_mod_sb(args.tp, XFS_TRANS_SB_FREXTENTS, freed_rtx);
/*
- * Update mp values into the real mp structure.
+ * Update the calculated values in the real mount structure.
*/
mp->m_rsumlevels = nmp->m_rsumlevels;
mp->m_rsumsize = nmp->m_rsumsize;
+ xfs_mount_sb_set_rextsize(mp, &mp->m_sb);
/*
* Recompute the growfsrt reservation from the new rsumsize.