On Mon, Oct 26, 2020 at 04:33:44PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > > Make sure that both inode btree block counters in the AGI are correct. > > Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > --- > repair/scan.c | 38 +++++++++++++++++++++++++++++++++++--- > 1 file changed, 35 insertions(+), 3 deletions(-) > > > diff --git a/repair/scan.c b/repair/scan.c > index 2a38ae5197c6..c826af7dee86 100644 > --- a/repair/scan.c > +++ b/repair/scan.c ... > @@ -2022,6 +2029,17 @@ scan_inobt( > return; > } > > + switch (magic) { > + case XFS_FIBT_MAGIC: > + case XFS_FIBT_CRC_MAGIC: > + ipriv->fino_blocks++; > + break; > + case XFS_IBT_MAGIC: > + case XFS_IBT_CRC_MAGIC: > + ipriv->ino_blocks++; > + break; > + } > + Is this intentionally not folded into the earlier magic switch statement? > /* > * check for btree blocks multiply claimed, any unknown/free state > * is ok in the bitmap block. ... > @@ -2393,6 +2414,17 @@ validate_agi( > } > } > > + if (xfs_sb_version_hasinobtcounts(&mp->m_sb)) { > + if (be32_to_cpu(agi->agi_iblocks) != priv.ino_blocks) > + do_warn(_("bad inobt block count %u, saw %u\n"), > + priv.ino_blocks, > + be32_to_cpu(agi->agi_iblocks)); These two params are backwards (here and below), no? Brian > + if (be32_to_cpu(agi->agi_fblocks) != priv.fino_blocks) > + do_warn(_("bad finobt block count %u, saw %u\n"), > + priv.fino_blocks, > + be32_to_cpu(agi->agi_fblocks)); > + } > + > if (be32_to_cpu(agi->agi_count) != agcnts->agicount) { > do_warn(_("agi_count %u, counted %u in ag %u\n"), > be32_to_cpu(agi->agi_count), agcnts->agicount, agno); >