diff options
Diffstat (limited to 'fs/xfs/scrub/bitmap.c')
-rw-r--r-- | fs/xfs/scrub/bitmap.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/xfs/scrub/bitmap.c b/fs/xfs/scrub/bitmap.c index fdadc9e1dc49..2c0450c39fba 100644 --- a/fs/xfs/scrub/bitmap.c +++ b/fs/xfs/scrub/bitmap.c @@ -38,6 +38,7 @@ xfs_bitmap_set( bmr->start = start; bmr->len = len; list_add_tail(&bmr->list, &bitmap->list); + bitmap->weight += len; return 0; } @@ -62,6 +63,7 @@ xfs_bitmap_init( struct xfs_bitmap *bitmap) { INIT_LIST_HEAD(&bitmap->list); + bitmap->weight = 0; } /* Compare two btree extents. */ @@ -164,6 +166,7 @@ xfs_bitmap_disunion( state |= LEFT_ALIGNED; if (sub_start + sub_len == br->start + br->len) state |= RIGHT_ALIGNED; + bitmap->weight -= sub_len; switch (state) { case LEFT_ALIGNED: /* Coincides with only the left. */ @@ -301,3 +304,11 @@ xfs_bitmap_set_btblocks( { return xfs_btree_visit_blocks(cur, xfs_bitmap_collect_btblock, bitmap); } + +/* Compute the weight of this bitmap. */ +uint64_t +xfs_bitmap_hweight( + struct xfs_bitmap *bitmap) +{ + return bitmap->weight; +} |