xfs: rename xfs_bitmap to xbitmap
Shorten the name of xfs_bitmap to xbitmap since the scrub bitmap has nothing to do with the libxfs bitmap. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com>
This commit is contained in:
@@ -18,14 +18,14 @@
|
||||
* This is the logical equivalent of bitmap |= mask(start, len).
|
||||
*/
|
||||
int
|
||||
xfs_bitmap_set(
|
||||
struct xfs_bitmap *bitmap,
|
||||
xbitmap_set(
|
||||
struct xbitmap *bitmap,
|
||||
uint64_t start,
|
||||
uint64_t len)
|
||||
{
|
||||
struct xfs_bitmap_range *bmr;
|
||||
struct xbitmap_range *bmr;
|
||||
|
||||
bmr = kmem_alloc(sizeof(struct xfs_bitmap_range), KM_MAYFAIL);
|
||||
bmr = kmem_alloc(sizeof(struct xbitmap_range), KM_MAYFAIL);
|
||||
if (!bmr)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -39,13 +39,13 @@ xfs_bitmap_set(
|
||||
|
||||
/* Free everything related to this bitmap. */
|
||||
void
|
||||
xfs_bitmap_destroy(
|
||||
struct xfs_bitmap *bitmap)
|
||||
xbitmap_destroy(
|
||||
struct xbitmap *bitmap)
|
||||
{
|
||||
struct xfs_bitmap_range *bmr;
|
||||
struct xfs_bitmap_range *n;
|
||||
struct xbitmap_range *bmr;
|
||||
struct xbitmap_range *n;
|
||||
|
||||
for_each_xfs_bitmap_extent(bmr, n, bitmap) {
|
||||
for_each_xbitmap_extent(bmr, n, bitmap) {
|
||||
list_del(&bmr->list);
|
||||
kmem_free(bmr);
|
||||
}
|
||||
@@ -53,24 +53,24 @@ xfs_bitmap_destroy(
|
||||
|
||||
/* Set up a per-AG block bitmap. */
|
||||
void
|
||||
xfs_bitmap_init(
|
||||
struct xfs_bitmap *bitmap)
|
||||
xbitmap_init(
|
||||
struct xbitmap *bitmap)
|
||||
{
|
||||
INIT_LIST_HEAD(&bitmap->list);
|
||||
}
|
||||
|
||||
/* Compare two btree extents. */
|
||||
static int
|
||||
xfs_bitmap_range_cmp(
|
||||
xbitmap_range_cmp(
|
||||
void *priv,
|
||||
struct list_head *a,
|
||||
struct list_head *b)
|
||||
{
|
||||
struct xfs_bitmap_range *ap;
|
||||
struct xfs_bitmap_range *bp;
|
||||
struct xbitmap_range *ap;
|
||||
struct xbitmap_range *bp;
|
||||
|
||||
ap = container_of(a, struct xfs_bitmap_range, list);
|
||||
bp = container_of(b, struct xfs_bitmap_range, list);
|
||||
ap = container_of(a, struct xbitmap_range, list);
|
||||
bp = container_of(b, struct xbitmap_range, list);
|
||||
|
||||
if (ap->start > bp->start)
|
||||
return 1;
|
||||
@@ -96,14 +96,14 @@ xfs_bitmap_range_cmp(
|
||||
#define LEFT_ALIGNED (1 << 0)
|
||||
#define RIGHT_ALIGNED (1 << 1)
|
||||
int
|
||||
xfs_bitmap_disunion(
|
||||
struct xfs_bitmap *bitmap,
|
||||
struct xfs_bitmap *sub)
|
||||
xbitmap_disunion(
|
||||
struct xbitmap *bitmap,
|
||||
struct xbitmap *sub)
|
||||
{
|
||||
struct list_head *lp;
|
||||
struct xfs_bitmap_range *br;
|
||||
struct xfs_bitmap_range *new_br;
|
||||
struct xfs_bitmap_range *sub_br;
|
||||
struct xbitmap_range *br;
|
||||
struct xbitmap_range *new_br;
|
||||
struct xbitmap_range *sub_br;
|
||||
uint64_t sub_start;
|
||||
uint64_t sub_len;
|
||||
int state;
|
||||
@@ -113,8 +113,8 @@ xfs_bitmap_disunion(
|
||||
return 0;
|
||||
ASSERT(!list_empty(&sub->list));
|
||||
|
||||
list_sort(NULL, &bitmap->list, xfs_bitmap_range_cmp);
|
||||
list_sort(NULL, &sub->list, xfs_bitmap_range_cmp);
|
||||
list_sort(NULL, &bitmap->list, xbitmap_range_cmp);
|
||||
list_sort(NULL, &sub->list, xbitmap_range_cmp);
|
||||
|
||||
/*
|
||||
* Now that we've sorted both lists, we iterate bitmap once, rolling
|
||||
@@ -124,11 +124,11 @@ xfs_bitmap_disunion(
|
||||
* list traversal is similar to merge sort, but we're deleting
|
||||
* instead. In this manner we avoid O(n^2) operations.
|
||||
*/
|
||||
sub_br = list_first_entry(&sub->list, struct xfs_bitmap_range,
|
||||
sub_br = list_first_entry(&sub->list, struct xbitmap_range,
|
||||
list);
|
||||
lp = bitmap->list.next;
|
||||
while (lp != &bitmap->list) {
|
||||
br = list_entry(lp, struct xfs_bitmap_range, list);
|
||||
br = list_entry(lp, struct xbitmap_range, list);
|
||||
|
||||
/*
|
||||
* Advance sub_br and/or br until we find a pair that
|
||||
@@ -181,7 +181,7 @@ xfs_bitmap_disunion(
|
||||
* Deleting from the middle: add the new right extent
|
||||
* and then shrink the left extent.
|
||||
*/
|
||||
new_br = kmem_alloc(sizeof(struct xfs_bitmap_range),
|
||||
new_br = kmem_alloc(sizeof(struct xbitmap_range),
|
||||
KM_MAYFAIL);
|
||||
if (!new_br) {
|
||||
error = -ENOMEM;
|
||||
@@ -247,8 +247,8 @@ out:
|
||||
* blocks going from the leaf towards the root.
|
||||
*/
|
||||
int
|
||||
xfs_bitmap_set_btcur_path(
|
||||
struct xfs_bitmap *bitmap,
|
||||
xbitmap_set_btcur_path(
|
||||
struct xbitmap *bitmap,
|
||||
struct xfs_btree_cur *cur)
|
||||
{
|
||||
struct xfs_buf *bp;
|
||||
@@ -261,7 +261,7 @@ xfs_bitmap_set_btcur_path(
|
||||
if (!bp)
|
||||
continue;
|
||||
fsb = XFS_DADDR_TO_FSB(cur->bc_mp, bp->b_bn);
|
||||
error = xfs_bitmap_set(bitmap, fsb, 1);
|
||||
error = xbitmap_set(bitmap, fsb, 1);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
@@ -271,12 +271,12 @@ xfs_bitmap_set_btcur_path(
|
||||
|
||||
/* Collect a btree's block in the bitmap. */
|
||||
STATIC int
|
||||
xfs_bitmap_collect_btblock(
|
||||
xbitmap_collect_btblock(
|
||||
struct xfs_btree_cur *cur,
|
||||
int level,
|
||||
void *priv)
|
||||
{
|
||||
struct xfs_bitmap *bitmap = priv;
|
||||
struct xbitmap *bitmap = priv;
|
||||
struct xfs_buf *bp;
|
||||
xfs_fsblock_t fsbno;
|
||||
|
||||
@@ -285,15 +285,15 @@ xfs_bitmap_collect_btblock(
|
||||
return 0;
|
||||
|
||||
fsbno = XFS_DADDR_TO_FSB(cur->bc_mp, bp->b_bn);
|
||||
return xfs_bitmap_set(bitmap, fsbno, 1);
|
||||
return xbitmap_set(bitmap, fsbno, 1);
|
||||
}
|
||||
|
||||
/* Walk the btree and mark the bitmap wherever a btree block is found. */
|
||||
int
|
||||
xfs_bitmap_set_btblocks(
|
||||
struct xfs_bitmap *bitmap,
|
||||
xbitmap_set_btblocks(
|
||||
struct xbitmap *bitmap,
|
||||
struct xfs_btree_cur *cur)
|
||||
{
|
||||
return xfs_btree_visit_blocks(cur, xfs_bitmap_collect_btblock,
|
||||
return xfs_btree_visit_blocks(cur, xbitmap_collect_btblock,
|
||||
XFS_BTREE_VISIT_ALL, bitmap);
|
||||
}
|
||||
|
Reference in New Issue
Block a user