Skip to content

Commit 28d756d

Browse files
author
Darrick J. Wong
committed
xfs: update sb field checks when metadir is turned on
When metadir is enabled, we want to check the two new rtgroups fields, and we don't want to check the old inumbers that are now in the metadir. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
1 parent edc038f commit 28d756d

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

fs/xfs/scrub/agheader.c

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,13 @@ xchk_superblock(
147147
if (xfs_has_metadir(sc->mp)) {
148148
if (sb->sb_metadirino != cpu_to_be64(mp->m_sb.sb_metadirino))
149149
xchk_block_set_preen(sc, bp);
150-
}
151-
152-
if (sb->sb_rbmino != cpu_to_be64(mp->m_sb.sb_rbmino))
153-
xchk_block_set_preen(sc, bp);
150+
} else {
151+
if (sb->sb_rbmino != cpu_to_be64(mp->m_sb.sb_rbmino))
152+
xchk_block_set_preen(sc, bp);
154153

155-
if (sb->sb_rsumino != cpu_to_be64(mp->m_sb.sb_rsumino))
156-
xchk_block_set_preen(sc, bp);
154+
if (sb->sb_rsumino != cpu_to_be64(mp->m_sb.sb_rsumino))
155+
xchk_block_set_preen(sc, bp);
156+
}
157157

158158
if (sb->sb_rextsize != cpu_to_be32(mp->m_sb.sb_rextsize))
159159
xchk_block_set_corrupt(sc, bp);
@@ -229,11 +229,13 @@ xchk_superblock(
229229
* sb_icount, sb_ifree, sb_fdblocks, sb_frexents
230230
*/
231231

232-
if (sb->sb_uquotino != cpu_to_be64(mp->m_sb.sb_uquotino))
233-
xchk_block_set_preen(sc, bp);
232+
if (!xfs_has_metadir(mp)) {
233+
if (sb->sb_uquotino != cpu_to_be64(mp->m_sb.sb_uquotino))
234+
xchk_block_set_preen(sc, bp);
234235

235-
if (sb->sb_gquotino != cpu_to_be64(mp->m_sb.sb_gquotino))
236-
xchk_block_set_preen(sc, bp);
236+
if (sb->sb_gquotino != cpu_to_be64(mp->m_sb.sb_gquotino))
237+
xchk_block_set_preen(sc, bp);
238+
}
237239

238240
/*
239241
* Skip the quota flags since repair will force quotacheck.
@@ -349,8 +351,10 @@ xchk_superblock(
349351
if (sb->sb_spino_align != cpu_to_be32(mp->m_sb.sb_spino_align))
350352
xchk_block_set_corrupt(sc, bp);
351353

352-
if (sb->sb_pquotino != cpu_to_be64(mp->m_sb.sb_pquotino))
353-
xchk_block_set_preen(sc, bp);
354+
if (!xfs_has_metadir(mp)) {
355+
if (sb->sb_pquotino != cpu_to_be64(mp->m_sb.sb_pquotino))
356+
xchk_block_set_preen(sc, bp);
357+
}
354358

355359
/* Don't care about sb_lsn */
356360
}
@@ -361,6 +365,14 @@ xchk_superblock(
361365
xchk_block_set_corrupt(sc, bp);
362366
}
363367

368+
if (xfs_has_metadir(mp)) {
369+
if (sb->sb_rgcount != cpu_to_be32(mp->m_sb.sb_rgcount))
370+
xchk_block_set_corrupt(sc, bp);
371+
372+
if (sb->sb_rgextents != cpu_to_be32(mp->m_sb.sb_rgextents))
373+
xchk_block_set_corrupt(sc, bp);
374+
}
375+
364376
/* Everything else must be zero. */
365377
if (memchr_inv(sb + 1, 0,
366378
BBTOB(bp->b_length) - sizeof(struct xfs_dsb)))

0 commit comments

Comments
 (0)