diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-07-14 11:05:41 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2022-10-14 14:16:29 -0700 |
commit | 29b621d45c6a305a8a032190d704a250488a8823 (patch) | |
tree | 0ccdc5b080dd759cbcb62516092e086fdaa456ba /fs/xfs/scrub/alloc.c | |
parent | fb3002944dbe0f3b612c0c96dfbaac0c813c0e3a (diff) |
xfs: replace xfs_btree_has_record with a general keyspace scanner
The current implementation of xfs_btree_has_record returns true if it
finds /any/ record within the given range. Unfortunately, that's not
sufficient for scrub. We want to be able to tell if a range of keyspace
for a btree is devoid of records, is totally mapped to records, or is
somewhere in between. By forcing this to be a boolean, we were
generally missing the "in between" case and returning incorrect results.
Fix the API so that we can tell the caller which of those three is the
current state.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/scrub/alloc.c')
-rw-r--r-- | fs/xfs/scrub/alloc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/xfs/scrub/alloc.c b/fs/xfs/scrub/alloc.c index 4d9ccc15b048..d8f2ba7efa22 100644 --- a/fs/xfs/scrub/alloc.c +++ b/fs/xfs/scrub/alloc.c @@ -146,15 +146,15 @@ xchk_xref_is_used_space( xfs_agblock_t agbno, xfs_extlen_t len) { - bool is_freesp; + enum xfs_btree_keyfill keyfill; int error; if (!sc->sa.bno_cur || xchk_skip_xref(sc->sm)) return; - error = xfs_alloc_has_record(sc->sa.bno_cur, agbno, len, &is_freesp); + error = xfs_alloc_scan_keyfill(sc->sa.bno_cur, agbno, len, &keyfill); if (!xchk_should_check_xref(sc, &error, &sc->sa.bno_cur)) return; - if (is_freesp) + if (keyfill != XFS_BTREE_KEYFILL_EMPTY) xchk_btree_xref_set_corrupt(sc, sc->sa.bno_cur, 0); } |