summaryrefslogtreecommitdiffstats
path: root/fs/xfs/scrub/bitmap.h
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2023-04-11 19:00:38 -0700
committerDarrick J. Wong <djwong@kernel.org>2023-04-11 19:00:38 -0700
commitfed050f3452da070fa90fc1b02c2bc2219d687a7 (patch)
tree6002bc16c07ec4b6055d04d21ba2bed8d6245411 /fs/xfs/scrub/bitmap.h
parenta47bd1e0e690d0296c3e48fc3d6f2d359c222d6c (diff)
downloadlinux-stable-fed050f3452da070fa90fc1b02c2bc2219d687a7.tar.gz
linux-stable-fed050f3452da070fa90fc1b02c2bc2219d687a7.tar.bz2
linux-stable-fed050f3452da070fa90fc1b02c2bc2219d687a7.zip
xfs: cross-reference rmap records with ag btrees
Strengthen the rmap btree record checker a little more by comparing OWN_FS and OWN_LOG reverse mappings against the AG headers and internal logs, respectively. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/scrub/bitmap.h')
-rw-r--r--fs/xfs/scrub/bitmap.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/xfs/scrub/bitmap.h b/fs/xfs/scrub/bitmap.h
index 972d5445cdb6..55441feb039f 100644
--- a/fs/xfs/scrub/bitmap.h
+++ b/fs/xfs/scrub/bitmap.h
@@ -38,6 +38,7 @@ int xbitmap_walk_bits(struct xbitmap *bitmap, xbitmap_walk_bits_fn fn,
void *priv);
bool xbitmap_empty(struct xbitmap *bitmap);
+bool xbitmap_test(struct xbitmap *bitmap, uint64_t start, uint64_t *len);
/* Bitmaps, but for type-checked for xfs_agblock_t */
@@ -66,6 +67,26 @@ static inline int xagb_bitmap_set(struct xagb_bitmap *bitmap,
return xbitmap_set(&bitmap->agbitmap, start, len);
}
+static inline bool
+xagb_bitmap_test(
+ struct xagb_bitmap *bitmap,
+ xfs_agblock_t start,
+ xfs_extlen_t *len)
+{
+ uint64_t biglen = *len;
+ bool ret;
+
+ ret = xbitmap_test(&bitmap->agbitmap, start, &biglen);
+
+ if (start + biglen >= UINT_MAX) {
+ ASSERT(0);
+ biglen = UINT_MAX - start;
+ }
+
+ *len = biglen;
+ return ret;
+}
+
static inline int xagb_bitmap_disunion(struct xagb_bitmap *bitmap,
struct xagb_bitmap *sub)
{