Skip to content

Commit ceaa0bd

Browse files
author
Darrick J. Wong
committed
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 <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]>
1 parent 7195f24 commit ceaa0bd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

fs/xfs/libxfs/xfs_ag.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ xfs_perag_alloc(
242242
* Pre-calculated geometry
243243
*/
244244
pag->block_count = __xfs_ag_block_count(mp, index, agcount, dblocks);
245-
pag->min_block = XFS_AGFL_BLOCK(mp);
245+
pag->min_block = XFS_AGFL_BLOCK(mp) + 1;
246246
__xfs_agino_range(mp, pag->block_count, &pag->agino_min,
247247
&pag->agino_max);
248248

fs/xfs/libxfs/xfs_ag.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ xfs_verify_agbno(struct xfs_perag *pag, xfs_agblock_t agbno)
222222
{
223223
if (agbno >= pag->block_count)
224224
return false;
225-
if (agbno <= pag->min_block)
225+
if (agbno < pag->min_block)
226226
return false;
227227
return true;
228228
}

0 commit comments

Comments
 (0)