]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: cross-reference realtime bitmap to realtime rmapbt scrubber
authorDarrick J. Wong <djwong@kernel.org>
Thu, 15 Aug 2024 18:49:01 +0000 (11:49 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Fri, 16 Aug 2024 21:54:26 +0000 (14:54 -0700)
When we're checking the realtime rmap btree entries, cross-reference
those entries with the realtime bitmap too.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
fs/xfs/scrub/rtrmap.c

index c60eda034b5d617142c22a7311c263b943068dcc..8769552612f356832843216a6fcecb5f10694c66 100644 (file)
@@ -143,6 +143,23 @@ xchk_rtrmapbt_check_mergeable(
        memcpy(&cr->prev_rec, irec, sizeof(struct xfs_rmap_irec));
 }
 
+/* Cross-reference with other metadata. */
+STATIC void
+xchk_rtrmapbt_xref(
+       struct xfs_scrub        *sc,
+       struct xfs_rmap_irec    *irec)
+{
+       xfs_rtblock_t           rtbno;
+
+       if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
+               return;
+
+       rtbno = xfs_rgbno_to_rtb(sc->mp, sc->sr.rtg->rtg_rgno,
+                       irec->rm_startblock);
+
+       xchk_xref_is_used_rt_space(sc, rtbno, irec->rm_blockcount);
+}
+
 /* Scrub a realtime rmapbt record. */
 STATIC int
 xchk_rtrmapbt_rec(
@@ -163,6 +180,7 @@ xchk_rtrmapbt_rec(
 
        xchk_rtrmapbt_check_mergeable(bs, cr, &irec);
        xchk_rtrmapbt_check_overlapping(bs, cr, &irec);
+       xchk_rtrmapbt_xref(bs->sc, &irec);
        return 0;
 }