From: Darrick J. Wong Date: Tue, 14 Nov 2023 12:27:44 +0000 (+0100) Subject: xfs: adjust the incore perag block_count when shrinking X-Git-Tag: v6.6.0~56 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=38d34b01d14597745e5d939b425048a3a10e16ed;p=thirdparty%2Fxfsprogs-dev.git xfs: adjust the incore perag block_count when shrinking Source kernel commit: 6868b8505c807ad9397d78cc4e07cb1cb3582152 If we reduce the number of blocks in an AG, we must update the incore geometry values as well. Fixes: 0800169e3e2c9 ("xfs: Pre-calculate per-AG agbno geometry") Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino --- diff --git a/libxfs/xfs_ag.c b/libxfs/xfs_ag.c index 75711cbae..ac34a1c23 100644 --- a/libxfs/xfs_ag.c +++ b/libxfs/xfs_ag.c @@ -999,6 +999,12 @@ xfs_ag_shrink_space( error = -ENOSPC; goto resv_init_out; } + + /* Update perag geometry */ + pag->block_count -= delta; + __xfs_agino_range(pag->pag_mount, pag->block_count, &pag->agino_min, + &pag->agino_max); + xfs_ialloc_log_agi(*tpp, agibp, XFS_AGI_LENGTH); xfs_alloc_log_agf(*tpp, agfbp, XFS_AGF_LENGTH); return 0;