summaryrefslogtreecommitdiff
path: root/fs/xfs
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2024-11-04 07:19:34 +0300
committerDarrick J. Wong <djwong@kernel.org>2024-11-06 00:38:44 +0300
commitceaa0bd773e2d6d5726d6535f605ecd6b26d2fcc (patch)
tree8cf1d1e9edefd7d51ce6c85f584d95177150f797 /fs/xfs
parent7195f240c6578caa9e24202a26aa612a7e8cba26 (diff)
downloadlinux-ceaa0bd773e2d6d5726d6535f605ecd6b26d2fcc.tar.xz
xfs: adjust min_block usage in xfs_verify_agbno
There's some weird logic in xfs_verify_agbno -- min_block ought to be the first agblock number in the AG that can be used by non-static metadata. However, we initialize it to the last agblock of the static metadata, which works due to the <= check, even though this isn't technically correct. Change the check to < and set min_block to the next agblock past the static metadata. This hasn't been an issue up to now, but we're going to move these things into the generic group struct, and this will cause problems with rtgroups, where min_block can be zero for an rtgroup that doesn't have a rt superblock. Note that there's no user-visible impact with the old logic, so this isn't a bug fix. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/libxfs/xfs_ag.c2
-rw-r--r--fs/xfs/libxfs/xfs_ag.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/fs/xfs/libxfs/xfs_ag.c b/fs/xfs/libxfs/xfs_ag.c
index 47e90dbb852b..8fe96a9e0472 100644
--- a/fs/xfs/libxfs/xfs_ag.c
+++ b/fs/xfs/libxfs/xfs_ag.c
@@ -242,7 +242,7 @@ xfs_perag_alloc(
* Pre-calculated geometry
*/
pag->block_count = __xfs_ag_block_count(mp, index, agcount, dblocks);
- pag->min_block = XFS_AGFL_BLOCK(mp);
+ pag->min_block = XFS_AGFL_BLOCK(mp) + 1;
__xfs_agino_range(mp, pag->block_count, &pag->agino_min,
&pag->agino_max);
diff --git a/fs/xfs/libxfs/xfs_ag.h b/fs/xfs/libxfs/xfs_ag.h
index 7290148fa6e6..9c22a76d58cf 100644
--- a/fs/xfs/libxfs/xfs_ag.h
+++ b/fs/xfs/libxfs/xfs_ag.h
@@ -222,7 +222,7 @@ xfs_verify_agbno(struct xfs_perag *pag, xfs_agblock_t agbno)
{
if (agbno >= pag->block_count)
return false;
- if (agbno <= pag->min_block)
+ if (agbno < pag->min_block)
return false;
return true;
}