summaryrefslogtreecommitdiff
path: root/fs/xfs/scrub/bitmap.h
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-09-01 10:40:19 -0700
committerDarrick J. Wong <djwong@kernel.org>2021-10-22 16:40:34 -0700
commit44ec255773601d541809e72e8f885c6df34383d5 (patch)
tree8e690c66c72af499b7efacdbcc452c24e66c035d /fs/xfs/scrub/bitmap.h
parent2d7577db95ff76fd964eedd8f5dae451b10b2165 (diff)
xfs: convert xbitmap to interval treerepair-bitmap-rework_2021-10-22
Convert the xbitmap code to use interval trees instead of linked lists. This reduces the amount of coding required to handle the disunion operation and in the future will make it easier to set bits in arbitrary order yet later be able to extract maximally sized extents, which we'll need for rebuilding certain structures. We define our own interval tree type so that it can deal with 64-bit indices even on 32-bit machines. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/scrub/bitmap.h')
-rw-r--r--fs/xfs/scrub/bitmap.h13
1 files changed, 5 insertions, 8 deletions
diff --git a/fs/xfs/scrub/bitmap.h b/fs/xfs/scrub/bitmap.h
index 6cba89c50a38..13aee3b0b908 100644
--- a/fs/xfs/scrub/bitmap.h
+++ b/fs/xfs/scrub/bitmap.h
@@ -6,21 +6,16 @@
#ifndef __XFS_SCRUB_BITMAP_H__
#define __XFS_SCRUB_BITMAP_H__
-struct xbitmap_range {
- struct list_head list;
- uint64_t start;
- uint64_t len;
-};
-
struct xbitmap {
- struct list_head list;
+ struct rb_root_cached xb_root;
};
void xbitmap_init(struct xbitmap *bitmap);
void xbitmap_destroy(struct xbitmap *bitmap);
+void xbitmap_clear(struct xbitmap *bitmap, uint64_t start, uint64_t len);
int xbitmap_set(struct xbitmap *bitmap, uint64_t start, uint64_t len);
-int xbitmap_disunion(struct xbitmap *bitmap, struct xbitmap *sub);
+void xbitmap_disunion(struct xbitmap *bitmap, struct xbitmap *sub);
int xbitmap_set_btcur_path(struct xbitmap *bitmap,
struct xfs_btree_cur *cur);
int xbitmap_set_btblocks(struct xbitmap *bitmap,
@@ -38,4 +33,6 @@ typedef int (*xbitmap_walk_fn)(uint64_t start, uint64_t len, void *priv);
int xbitmap_walk(struct xbitmap *bitmap, xbitmap_walk_fn fn,
void *priv);
+bool xbitmap_empty(struct xbitmap *bitmap);
+
#endif /* __XFS_SCRUB_BITMAP_H__ */