]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: adjust the incore perag block_count when shrinking
authorDarrick J. Wong <djwong@kernel.org>
Tue, 14 Nov 2023 12:27:44 +0000 (13:27 +0100)
committerCarlos Maiolino <cem@kernel.org>
Thu, 16 Nov 2023 09:41:17 +0000 (10:41 +0100)
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 <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
libxfs/xfs_ag.c

index 75711cbaef95195fa2c3b7d40575d221e7b0c0e8..ac34a1c233c275f6ebac465a3c9de257b6ec8180 100644 (file)
@@ -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;