Skip to content

Commit

Permalink
xfs: don't check agf_btreeblks on pre-lazysbcount filesystems
Browse files Browse the repository at this point in the history
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 <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
  • Loading branch information
Darrick J. Wong committed Apr 29, 2021
1 parent 1aec7c3 commit e6c0107
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion fs/xfs/scrub/agheader.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,10 @@ xchk_agf_xref_btreeblks(
xfs_agblock_t btreeblks;
int error;

/* agf_btreeblks didn't exist before lazysbcount */
if (!xfs_sb_version_haslazysbcount(&sc->mp->m_sb))
return;

/* Check agf_rmap_blocks; set up for agf_btreeblks check */
if (sc->sa.rmap_cur) {
error = xfs_btree_count_blocks(sc->sa.rmap_cur, &blocks);
Expand Down Expand Up @@ -581,7 +585,8 @@ xchk_agf(
xchk_block_set_corrupt(sc, sc->sa.agf_bp);
if (pag->pagf_flcount != be32_to_cpu(agf->agf_flcount))
xchk_block_set_corrupt(sc, sc->sa.agf_bp);
if (pag->pagf_btreeblks != be32_to_cpu(agf->agf_btreeblks))
if (xfs_sb_version_haslazysbcount(&sc->mp->m_sb) &&
pag->pagf_btreeblks != be32_to_cpu(agf->agf_btreeblks))
xchk_block_set_corrupt(sc, sc->sa.agf_bp);
xfs_perag_put(pag);

Expand Down
3 changes: 2 additions & 1 deletion fs/xfs/scrub/fscounters.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ xchk_fscount_aggregate_agcounts(
/* Add up the free/freelist/bnobt/cntbt blocks */
fsc->fdblocks += pag->pagf_freeblks;
fsc->fdblocks += pag->pagf_flcount;
fsc->fdblocks += pag->pagf_btreeblks;
if (xfs_sb_version_haslazysbcount(&sc->mp->m_sb))
fsc->fdblocks += pag->pagf_btreeblks;

/*
* Per-AG reservations are taken out of the incore counters,
Expand Down

0 comments on commit e6c0107

Please sign in to comment.