summaryrefslogtreecommitdiff
path: root/fs/xfs/scrub/bitmap.h
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2018-07-30 11:18:13 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2018-07-31 13:18:08 -0700
commit86d969b425d7ecf774799b70142b957dc267575b (patch)
tree740eb40605ec763a1e53deb6417c03e81647f18d /fs/xfs/scrub/bitmap.h
parent51d626903083f7bd651d38b031775740ed41758c (diff)
xfs: refactor the xrep_extent_list into xfs_bitmap
As mentioned previously, the xrep_extent_list basically implements a bitmap with two functions: set and disjoint union. Rename all these functions to xfs_bitmap to shorten the name and make it more obvious what we're doing. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com>
Diffstat (limited to 'fs/xfs/scrub/bitmap.h')
-rw-r--r--fs/xfs/scrub/bitmap.h35
1 files changed, 15 insertions, 20 deletions
diff --git a/fs/xfs/scrub/bitmap.h b/fs/xfs/scrub/bitmap.h
index 1038157695a8..dad652ee9177 100644
--- a/fs/xfs/scrub/bitmap.h
+++ b/fs/xfs/scrub/bitmap.h
@@ -6,32 +6,27 @@
#ifndef __XFS_SCRUB_BITMAP_H__
#define __XFS_SCRUB_BITMAP_H__
-struct xrep_extent {
+struct xfs_bitmap_range {
struct list_head list;
- xfs_fsblock_t fsbno;
- xfs_extlen_t len;
+ uint64_t start;
+ uint64_t len;
};
-struct xrep_extent_list {
+struct xfs_bitmap {
struct list_head list;
};
-static inline void
-xrep_init_extent_list(
- struct xrep_extent_list *exlist)
-{
- INIT_LIST_HEAD(&exlist->list);
-}
+void xfs_bitmap_init(struct xfs_bitmap *bitmap);
+void xfs_bitmap_destroy(struct xfs_bitmap *bitmap);
-#define for_each_xrep_extent_safe(rbe, n, exlist) \
- list_for_each_entry_safe((rbe), (n), &(exlist)->list, list)
-int xrep_collect_btree_extent(struct xfs_scrub *sc,
- struct xrep_extent_list *btlist, xfs_fsblock_t fsbno,
- xfs_extlen_t len);
-void xrep_cancel_btree_extents(struct xfs_scrub *sc,
- struct xrep_extent_list *btlist);
-int xrep_subtract_extents(struct xfs_scrub *sc,
- struct xrep_extent_list *exlist,
- struct xrep_extent_list *sublist);
+#define for_each_xfs_bitmap_extent(bex, n, bitmap) \
+ list_for_each_entry_safe((bex), (n), &(bitmap)->list, list)
+
+#define for_each_xfs_bitmap_block(b, bex, n, bitmap) \
+ list_for_each_entry_safe((bex), (n), &(bitmap)->list, list) \
+ for ((b) = bex->start; (b) < bex->start + bex->len; (b)++)
+
+int xfs_bitmap_set(struct xfs_bitmap *bitmap, uint64_t start, uint64_t len);
+int xfs_bitmap_disunion(struct xfs_bitmap *bitmap, struct xfs_bitmap *sub);
#endif /* __XFS_SCRUB_BITMAP_H__ */