[PATCH 2/5] xfs: remove struct xfboff_bitmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Just use struct xbitmap64 directly.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
 fs/xfs/scrub/xfbtree.c | 41 +++++------------------------------------
 fs/xfs/scrub/xfbtree.h | 14 +++++---------
 2 files changed, 10 insertions(+), 45 deletions(-)

diff --git a/fs/xfs/scrub/xfbtree.c b/fs/xfs/scrub/xfbtree.c
index 3620acc008aa59..63b69aeadc623d 100644
--- a/fs/xfs/scrub/xfbtree.c
+++ b/fs/xfs/scrub/xfbtree.c
@@ -24,37 +24,6 @@
 #include "scrub/bitmap.h"
 #include "scrub/trace.h"
 
-/* Bitmaps, but for type-checked for xfileoff_t */
-
-static inline void xfboff_bitmap_init(struct xfboff_bitmap *bitmap)
-{
-	xbitmap64_init(&bitmap->xfoffbitmap);
-}
-
-static inline void xfboff_bitmap_destroy(struct xfboff_bitmap *bitmap)
-{
-	xbitmap64_destroy(&bitmap->xfoffbitmap);
-}
-
-static inline int xfboff_bitmap_set(struct xfboff_bitmap *bitmap,
-		xfs_fileoff_t start, xfs_filblks_t len)
-{
-	return xbitmap64_set(&bitmap->xfoffbitmap, start, len);
-}
-
-static inline int xfboff_bitmap_take_first_set(struct xfboff_bitmap *bitmap,
-		xfileoff_t *valp)
-{
-	uint64_t	val;
-	int		error;
-
-	error = xbitmap64_take_first_set(&bitmap->xfoffbitmap, 0, -1ULL, &val);
-	if (error)
-		return error;
-	*valp = val;
-	return 0;
-}
-
 /* Extract the buftarg target for this xfile btree. */
 struct xfs_buftarg *
 xfbtree_target(struct xfbtree *xfbtree)
@@ -295,7 +264,7 @@ void
 xfbtree_destroy(
 	struct xfbtree		*xfbt)
 {
-	xfboff_bitmap_destroy(&xfbt->freespace);
+	xbitmap64_destroy(&xfbt->freespace);
 	xfs_buftarg_drain(xfbt->target);
 	kfree(xfbt);
 }
@@ -377,7 +346,7 @@ xfbtree_create(
 	if (cfg->flags & XFBTREE_DIRECT_MAP)
 		xfbt->target->bt_flags |= XFS_BUFTARG_DIRECT_MAP;
 
-	xfboff_bitmap_init(&xfbt->freespace);
+	xbitmap64_init(&xfbt->freespace);
 
 	/* Set up min/maxrecs for this btree. */
 	if (cfg->btree_ops->geom_flags & XFS_BTREE_LONG_PTRS)
@@ -402,7 +371,7 @@ xfbtree_create(
 	return 0;
 
 err_freesp:
-	xfboff_bitmap_destroy(&xfbt->freespace);
+	xbitmap64_destroy(&xfbt->freespace);
 	xfs_buftarg_drain(xfbt->target);
 	kfree(xfbt);
 	return error;
@@ -432,7 +401,7 @@ xfbtree_alloc_block(
 	 * Find the first free block in the free space bitmap and take it.  If
 	 * none are found, seek to end of the file.
 	 */
-	error = xfboff_bitmap_take_first_set(&xfbt->freespace, &bt_xfoff);
+	error = xbitmap64_take_first_set(&xfbt->freespace, 0, -1ULL, &bt_xfoff);
 	if (error == -ENODATA) {
 		bt_xfoff = xfbt->highest_offset++;
 		error = 0;
@@ -479,7 +448,7 @@ xfbtree_free_block(
 
 	trace_xfbtree_free_block(xfbt, cur, bt_xfoff);
 
-	return xfboff_bitmap_set(&xfbt->freespace, bt_xfoff, bt_xflen);
+	return xbitmap64_set(&xfbt->freespace, bt_xfoff, bt_xflen);
 }
 
 /* Return the minimum number of records for a btree block. */
diff --git a/fs/xfs/scrub/xfbtree.h b/fs/xfs/scrub/xfbtree.h
index e98f9261464a06..d17be23aca7dbb 100644
--- a/fs/xfs/scrub/xfbtree.h
+++ b/fs/xfs/scrub/xfbtree.h
@@ -12,24 +12,20 @@
 
 /* xfile-backed in-memory btrees */
 
-struct xfboff_bitmap {
-	struct xbitmap64		xfoffbitmap;
-};
-
 struct xfbtree {
 	/* buffer cache target for the xfile backing this in-memory btree */
 	struct xfs_buftarg		*target;
 
-	/* Bitmap of free space from pos to used */
-	struct xfboff_bitmap		freespace;
+	/* Highest xfile offset that has been written to. */
+	xfileoff_t			highest_offset;
+
+	/* Bitmap of free space from pos to highest_offset */
+	struct xbitmap64		freespace;
 
 	/* Fake header block information */
 	union xfs_btree_ptr		root;
 	uint32_t			nlevels;
 
-	/* Highest xfile offset that has been written to. */
-	xfileoff_t			highest_offset;
-
 	/* Owner of this btree. */
 	unsigned long long		owner;
 
-- 
2.39.2





[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux