summaryrefslogtreecommitdiff
path: root/fs/xfs/scrub/alloc.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2023-04-12 05:00:10 +0300
committerDarrick J. Wong <djwong@kernel.org>2023-04-12 05:00:10 +0300
commit6abc7aef85b1f42cb39a3149f4ab64ca255e41e6 (patch)
tree0603ee56acac7e83040dbd8becb56e7b8414b605 /fs/xfs/scrub/alloc.c
parentbd7e795108ccd8d0f3dc34e16957cbba7e89f342 (diff)
downloadlinux-6abc7aef85b1f42cb39a3149f4ab64ca255e41e6.tar.xz
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 conflated sparseness and fullness, which caused scrub to return 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> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/scrub/alloc.c')
-rw-r--r--fs/xfs/scrub/alloc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/xfs/scrub/alloc.c b/fs/xfs/scrub/alloc.c
index 53de04c6027c..5920fe051543 100644
--- a/fs/xfs/scrub/alloc.c
+++ b/fs/xfs/scrub/alloc.c
@@ -144,15 +144,15 @@ xchk_xref_is_used_space(
xfs_agblock_t agbno,
xfs_extlen_t len)
{
- bool is_freesp;
+ enum xbtree_recpacking outcome;
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_has_records(sc->sa.bno_cur, agbno, len, &outcome);
if (!xchk_should_check_xref(sc, &error, &sc->sa.bno_cur))
return;
- if (is_freesp)
+ if (outcome != XBTREE_RECPACKING_EMPTY)
xchk_btree_xref_set_corrupt(sc, sc->sa.bno_cur, 0);
}