From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: darrick.wong@oracle.com, bfoster@redhat.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 3/5] xfs: support inode btree blockcounts in online scrub
Date: Tue, 01 Sep 2020 19:56:11 -0700 [thread overview]
Message-ID: <159901537133.547164.1323656639235820928.stgit@magnolia> (raw)
In-Reply-To: <159901535219.547164.1381621861988558776.stgit@magnolia>
From: Darrick J. Wong <darrick.wong@oracle.com>
Add the necessary bits to the online scrub code to check the inode btree
counters when enabled.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
---
| 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
--git a/fs/xfs/scrub/agheader.c b/fs/xfs/scrub/agheader.c
index e9bcf1faa183..ae8e2e0ac64a 100644
--- a/fs/xfs/scrub/agheader.c
+++ b/fs/xfs/scrub/agheader.c
@@ -781,6 +781,35 @@ xchk_agi_xref_icounts(
xchk_block_xref_set_corrupt(sc, sc->sa.agi_bp);
}
+/* Check agi_[fi]blocks against tree size */
+static inline void
+xchk_agi_xref_fiblocks(
+ struct xfs_scrub *sc)
+{
+ struct xfs_agi *agi = sc->sa.agi_bp->b_addr;
+ xfs_agblock_t blocks;
+ int error = 0;
+
+ if (!xfs_sb_version_hasinobtcounts(&sc->mp->m_sb))
+ return;
+
+ if (sc->sa.ino_cur) {
+ error = xfs_btree_count_blocks(sc->sa.ino_cur, &blocks);
+ if (!xchk_should_check_xref(sc, &error, &sc->sa.ino_cur))
+ return;
+ if (blocks != be32_to_cpu(agi->agi_iblocks))
+ xchk_block_xref_set_corrupt(sc, sc->sa.agi_bp);
+ }
+
+ if (sc->sa.fino_cur) {
+ error = xfs_btree_count_blocks(sc->sa.fino_cur, &blocks);
+ if (!xchk_should_check_xref(sc, &error, &sc->sa.fino_cur))
+ return;
+ if (blocks != be32_to_cpu(agi->agi_fblocks))
+ xchk_block_xref_set_corrupt(sc, sc->sa.agi_bp);
+ }
+}
+
/* Cross-reference with the other btrees. */
STATIC void
xchk_agi_xref(
@@ -804,6 +833,7 @@ xchk_agi_xref(
xchk_agi_xref_icounts(sc);
xchk_xref_is_owned_by(sc, agbno, 1, &XFS_RMAP_OINFO_FS);
xchk_xref_is_not_shared(sc, agbno, 1);
+ xchk_agi_xref_fiblocks(sc);
/* scrub teardown will take care of sc->sa for us */
}
next prev parent reply other threads:[~2020-09-02 2:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-02 2:55 [PATCH v4 0/5] xfs: add inode btree blocks counters to the AGI header Darrick J. Wong
2020-09-02 2:55 ` [PATCH 1/5] xfs: store inode btree block counts in " Darrick J. Wong
2020-09-02 13:23 ` Brian Foster
2020-09-02 17:13 ` Darrick J. Wong
2020-09-02 2:56 ` [PATCH 2/5] xfs: use the finobt block counts to speed up mount times Darrick J. Wong
2020-09-02 2:56 ` Darrick J. Wong [this message]
2020-09-02 2:56 ` [PATCH 4/5] xfs: support inode btree blockcounts in online repair Darrick J. Wong
2020-09-02 13:23 ` Brian Foster
2020-09-02 2:56 ` [PATCH 5/5] xfs: enable new inode btree counters feature Darrick J. Wong
-- strict thread matches above, loose matches on Subject: below --
2020-08-28 2:36 [PATCH v3 0/5] xfs: add inode btree blocks counters to the AGI header Darrick J. Wong
2020-08-28 2:36 ` [PATCH 3/5] xfs: support inode btree blockcounts in online scrub Darrick J. Wong
2020-08-31 19:06 ` Brian Foster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=159901537133.547164.1323656639235820928.stgit@magnolia \
--to=darrick.wong@oracle.com \
--cc=bfoster@redhat.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).