summaryrefslogtreecommitdiff
path: root/fs/xfs/scrub/alloc.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2018-01-16 18:53:06 -0800
committerDarrick J. Wong <darrick.wong@oracle.com>2018-01-17 21:00:45 -0800
commit52dc4b44af74196ded6413304542ead0257b5cda (patch)
treef5896fc577ede48201cefa0ae25b5ae28113c147 /fs/xfs/scrub/alloc.c
parent166d76410d7ac08ba2fd90f33ebb545e21fd6b3a (diff)
xfs: cross-reference with the bnobt
When we're scrubbing various btrees, cross-reference the records with the bnobt to ensure that we don't also think the space is free. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/scrub/alloc.c')
-rw-r--r--fs/xfs/scrub/alloc.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/xfs/scrub/alloc.c b/fs/xfs/scrub/alloc.c
index 03ed403ff0d3..9b45585c0992 100644
--- a/fs/xfs/scrub/alloc.c
+++ b/fs/xfs/scrub/alloc.c
@@ -113,3 +113,23 @@ xfs_scrub_cntbt(
{
return xfs_scrub_allocbt(sc, XFS_BTNUM_CNT);
}
+
+/* xref check that the extent is not free */
+void
+xfs_scrub_xref_is_used_space(
+ struct xfs_scrub_context *sc,
+ xfs_agblock_t agbno,
+ xfs_extlen_t len)
+{
+ bool is_freesp;
+ int error;
+
+ if (!sc->sa.bno_cur)
+ return;
+
+ error = xfs_alloc_has_record(sc->sa.bno_cur, agbno, len, &is_freesp);
+ if (!xfs_scrub_should_check_xref(sc, &error, &sc->sa.bno_cur))
+ return;
+ if (is_freesp)
+ xfs_scrub_btree_xref_set_corrupt(sc, sc->sa.bno_cur, 0);
+}