Skip to content

Commit e6c0107

Browse files
author
Darrick J. Wong
committed
xfs: don't check agf_btreeblks on pre-lazysbcount filesystems
The AGF free space btree block counter wasn't added until the lazysbcount feature was added to XFS midway through the life of the V4 format, so ignore the field when checking. Online AGF repair requires rmapbt, so it doesn't need the feature check. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Dave Chinner <[email protected]>
1 parent 1aec7c3 commit e6c0107

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

fs/xfs/scrub/agheader.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,10 @@ xchk_agf_xref_btreeblks(
416416
xfs_agblock_t btreeblks;
417417
int error;
418418

419+
/* agf_btreeblks didn't exist before lazysbcount */
420+
if (!xfs_sb_version_haslazysbcount(&sc->mp->m_sb))
421+
return;
422+
419423
/* Check agf_rmap_blocks; set up for agf_btreeblks check */
420424
if (sc->sa.rmap_cur) {
421425
error = xfs_btree_count_blocks(sc->sa.rmap_cur, &blocks);
@@ -581,7 +585,8 @@ xchk_agf(
581585
xchk_block_set_corrupt(sc, sc->sa.agf_bp);
582586
if (pag->pagf_flcount != be32_to_cpu(agf->agf_flcount))
583587
xchk_block_set_corrupt(sc, sc->sa.agf_bp);
584-
if (pag->pagf_btreeblks != be32_to_cpu(agf->agf_btreeblks))
588+
if (xfs_sb_version_haslazysbcount(&sc->mp->m_sb) &&
589+
pag->pagf_btreeblks != be32_to_cpu(agf->agf_btreeblks))
585590
xchk_block_set_corrupt(sc, sc->sa.agf_bp);
586591
xfs_perag_put(pag);
587592

fs/xfs/scrub/fscounters.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ xchk_fscount_aggregate_agcounts(
182182
/* Add up the free/freelist/bnobt/cntbt blocks */
183183
fsc->fdblocks += pag->pagf_freeblks;
184184
fsc->fdblocks += pag->pagf_flcount;
185-
fsc->fdblocks += pag->pagf_btreeblks;
185+
if (xfs_sb_version_haslazysbcount(&sc->mp->m_sb))
186+
fsc->fdblocks += pag->pagf_btreeblks;
186187

187188
/*
188189
* Per-AG reservations are taken out of the incore counters,

0 commit comments

Comments
 (0)