]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: cross-reference realtime bitmap to realtime rmapbt scrubber
authorDarrick J. Wong <djwong@kernel.org>
Mon, 23 Sep 2024 20:42:09 +0000 (13:42 -0700)
committerChristoph Hellwig <hch@lst.de>
Wed, 9 Oct 2024 13:55:46 +0000 (15:55 +0200)
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 2781c15c81867212e22fad431832b33f21df3892..49d0ed9f6298f816f00f9b69a8c532f7ed5e2149 100644 (file)
@@ -143,6 +143,20 @@ 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)
+{
+       if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
+               return;
+
+       xchk_xref_is_used_rt_space(sc,
+                       xfs_rgbno_to_rtb(sc->sr.rtg, irec->rm_startblock),
+                       irec->rm_blockcount);
+}
+
 /* Scrub a realtime rmapbt record. */
 STATIC int
 xchk_rtrmapbt_rec(
@@ -163,6 +177,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;
 }