summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2019-01-16 10:12:38 -0800
committerDarrick J. Wong <darrick.wong@oracle.com>2019-02-04 09:31:22 -0800
commitd289cd66856e46b6eb56f5d6208daa131fd9da90 (patch)
tree2f1256c836a6b047ecbcba960670dbd55c0a1fe4
parent0ac8ec8adb7ee81806dc16ee0f178a25d4c08ded (diff)
xfs: cross-reference realtime bitmap to realtime rmapbt scrubber
When we're checking the realtime rmapbt, cross-reference the entries with the realtime bitmap too. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-rw-r--r--fs/xfs/scrub/rtbitmap.c5
-rw-r--r--fs/xfs/scrub/rtrmap.c14
2 files changed, 15 insertions, 4 deletions
diff --git a/fs/xfs/scrub/rtbitmap.c b/fs/xfs/scrub/rtbitmap.c
index dbe115b075f7..43912027a15d 100644
--- a/fs/xfs/scrub/rtbitmap.c
+++ b/fs/xfs/scrub/rtbitmap.c
@@ -143,13 +143,10 @@ xchk_xref_is_used_rt_space(
do_div(startext, sc->mp->m_sb.sb_rextsize);
do_div(endext, sc->mp->m_sb.sb_rextsize);
extcount = endext - startext + 1;
- xfs_ilock(sc->mp->m_rbmip, XFS_ILOCK_SHARED | XFS_ILOCK_RTBITMAP);
error = xfs_rtalloc_extent_is_free(sc->mp, sc->tp, startext, extcount,
&is_free);
if (!xchk_should_check_xref(sc, &error, NULL))
- goto out_unlock;
+ return;
if (is_free)
xchk_ino_xref_set_corrupt(sc, sc->mp->m_rbmip->i_ino);
-out_unlock:
- xfs_iunlock(sc->mp->m_rbmip, XFS_ILOCK_SHARED | XFS_ILOCK_RTBITMAP);
}
diff --git a/fs/xfs/scrub/rtrmap.c b/fs/xfs/scrub/rtrmap.c
index 95e182a306b9..1204f9648c83 100644
--- a/fs/xfs/scrub/rtrmap.c
+++ b/fs/xfs/scrub/rtrmap.c
@@ -56,6 +56,16 @@ xchk_setup_rtrmapbt(
/* Realtime reverse mapping. */
+/* Cross-reference with other metadata. */
+STATIC void
+xchk_rtrmapbt_xref(
+ struct xfs_scrub *sc,
+ struct xfs_rmap_irec *irec)
+{
+ xchk_xref_is_used_rt_space(sc, irec->rm_startblock,
+ irec->rm_blockcount);
+}
+
/* Scrub a realtime rmapbt record. */
STATIC int
xchk_rtrmapbt_helper(
@@ -86,6 +96,10 @@ xchk_rtrmapbt_helper(
if (is_bmbt || non_inode || is_attr)
xchk_btree_set_corrupt(bs->sc, bs->cur, 0);
+ if (bs->sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
+ goto out;
+
+ xchk_rtrmapbt_xref(bs->sc, &irec);
out:
return error;
}