xfs: pass back updated nb from xfs_growfs_compute_deltas
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/2 xfs: pass back updated nb from xfs_growfs_compute_deltas
xfs_growfs_compute_deltas can update nb for corner cases like a number of blocks that would create a less the minimal sized AG, or running past the max AG limit. Pass back the calculated value to the caller, as it relies on to calculate the new numeber of perag structures.
Note that the grown file system size is not affected by this miscaculation as it uses the passed back delta value.
--- fs/xfs/libxfs/xfs_ag.c | 10 +++++----- fs/xfs/libxfs/xfs_ag.h | 2 +- fs/xfs/xfs_fsops.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)
fs/xfs/libxfs/xfs_ag.c +5 -5
@@ -866,7 +866,7 @@ xfs_ag_shrink_space(void xfs_growfs_compute_deltas (struct xfs_mount *mp, -xfs_rfsblock_t nb, +xfs_rfsblock_t *nb,int64_t *deltap,xfs_agnumber_t *nagcountp) {
@@ -874,19 +874,19 @@ xfs_growfs_compute_deltas(int64_t delta;xfs_agnumber_t nagcount; - nb_div = nb; + nb_div = *nb; nb_mod =do_div (nb_div, mp->m_sb.sb_agblocks);if (nb_mod && nb_mod >=XFS_MIN_AG_BLOCKS ) nb_div++;else if (nb_mod) - nb = nb_div * mp->m_sb.sb_agblocks; + *nb = nb_div * mp->m_sb.sb_agblocks;if (nb_div >XFS_MAX_AGNUMBER +1 ) { nb_div =XFS_MAX_AGNUMBER +1 ; - nb = nb_div * mp->m_sb.sb_agblocks; + *nb = nb_div * mp->m_sb.sb_agblocks; } nagcount = nb_div; - delta = nb - mp->m_sb.sb_dblocks; + delta = *nb - mp->m_sb.sb_dblocks; *deltap = delta; *nagcountp = nagcount; }
fs/xfs/libxfs/xfs_ag.h +1 -1
@@ -330,7 +330,7 @@ int xfs_ag_init_headers(struct xfs_mount *mp, struct aghdr_init_data *id);int xfs_ag_shrink_space (struct xfs_perag *pag,struct xfs_trans **tpp,xfs_extlen_t delta);void -xfs_growfs_compute_deltas (struct xfs_mount *mp,xfs_rfsblock_t nb, +xfs_growfs_compute_deltas (struct xfs_mount *mp,xfs_rfsblock_t *nb,int64_t *deltap,xfs_agnumber_t *nagcountp);int xfs_ag_extend_space (struct xfs_perag *pag,struct xfs_trans *tp,xfs_extlen_t len);
fs/xfs/xfs_fsops.c +1 -1
@@ -124,7 +124,7 @@ xfs_growfs_data_private( mp->m_sb.sb_rextsize);if (error)return error; -xfs_growfs_compute_deltas (mp, nb, &delta, &nagcount); +xfs_growfs_compute_deltas (mp, &nb, &delta, &nagcount);/* * Reject filesystems with a single AG because they are not
Signature · 1 line
2.53.0
Quoted 4 lines · Christoph Hellwig
xfs_growfs_compute_deltascan update nb for corner cases like a number of blocks that would create a less the minimal sized AG, or running past the max AG limit. Pass back the calculated value to the caller, as it relies on to calculate the new numeber of perag structures.
'number' (will fix it at commit time).
Quoted 9 lines
Note that the grown file system size is not affected by this miscaculation as it uses the passed back delta value.
Fixes a49b7ff63f98 ("xfs: Refactoring the nagcount and delta calculation")Cc <[email protected]> # v7.0Signed-off-by Christoph Hellwig <[email protected]>Reviewed-by "Darrick J. Wong" <[email protected]>---
Quoted 71 lines
fs/xfs/libxfs/xfs_ag.c | 10 +++++----- fs/xfs/libxfs/xfs_ag.h | 2 +- fs/xfs/xfs_fsops.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)fs/xfs/libxfs/xfs_ag.c +5
-5@@ -866,7 +866,7 @@ xfs_ag_shrink_space(void xfs_growfs_compute_deltas (struct xfs_mount *mp, -xfs_rfsblock_t nb, +xfs_rfsblock_t *nb,int64_t *deltap,xfs_agnumber_t *nagcountp) {@@ -874,19 +874,19 @@ xfs_growfs_compute_deltas(int64_t delta;xfs_agnumber_t nagcount; - nb_div = nb; + nb_div = *nb; nb_mod =do_div (nb_div, mp->m_sb.sb_agblocks);if (nb_mod && nb_mod >=XFS_MIN_AG_BLOCKS ) nb_div++;else if (nb_mod) - nb = nb_div * mp->m_sb.sb_agblocks; + *nb = nb_div * mp->m_sb.sb_agblocks;if (nb_div >XFS_MAX_AGNUMBER +1 ) { nb_div =XFS_MAX_AGNUMBER +1 ; - nb = nb_div * mp->m_sb.sb_agblocks; + *nb = nb_div * mp->m_sb.sb_agblocks; } nagcount = nb_div; - delta = nb - mp->m_sb.sb_dblocks; + delta = *nb - mp->m_sb.sb_dblocks; *deltap = delta; *nagcountp = nagcount; }fs/xfs/libxfs/xfs_ag.h +1
-1@@ -330,7 +330,7 @@ int xfs_ag_init_headers(struct xfs_mount *mp, struct aghdr_init_data *id);int xfs_ag_shrink_space (struct xfs_perag *pag,struct xfs_trans **tpp,xfs_extlen_t delta);void -xfs_growfs_compute_deltas (struct xfs_mount *mp,xfs_rfsblock_t nb, +xfs_growfs_compute_deltas (struct xfs_mount *mp,xfs_rfsblock_t *nb,int64_t *deltap,xfs_agnumber_t *nagcountp);int xfs_ag_extend_space (struct xfs_perag *pag,struct xfs_trans *tp,xfs_extlen_t len);fs/xfs/xfs_fsops.c +1
-1@@ -124,7 +124,7 @@ xfs_growfs_data_private( mp->m_sb.sb_rextsize);if (error)return error; -xfs_growfs_compute_deltas (mp, nb, &delta, &nagcount); +xfs_growfs_compute_deltas (mp, &nb, &delta, &nagcount);/* * Reject filesystems with a single AG because they are not Signature · 1 line
2.53.0