diff options
author | Howard McLauchlan <hmclauchlan@fb.com> | 2018-04-19 04:02:35 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-05-28 19:07:18 +0300 |
commit | 6faa8f475eeaf5d89f985ad3b91b90ab0cf219e6 (patch) | |
tree | 305a98f0ed53869af41ec4514600a20dc709e3b3 /fs/btrfs/free-space-tree.c | |
parent | f46b24c9457143a367c6707eac82d546e2bcf280 (diff) | |
download | linux-6faa8f475eeaf5d89f985ad3b91b90ab0cf219e6.tar.xz |
btrfs: clean up le_bitmap_{set, clear}()
le_bitmap_set() is only used by free-space-tree, so move it there and
make it static. le_bitmap_clear() is not used, so remove it.
Signed-off-by: Howard McLauchlan <hmclauchlan@fb.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/free-space-tree.c')
-rw-r--r-- | fs/btrfs/free-space-tree.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/btrfs/free-space-tree.c b/fs/btrfs/free-space-tree.c index 32a0f6cb5594..e03830d83311 100644 --- a/fs/btrfs/free-space-tree.c +++ b/fs/btrfs/free-space-tree.c @@ -157,6 +157,26 @@ static u8 *alloc_bitmap(u32 bitmap_size) return ret; } +static void le_bitmap_set(u8 *map, unsigned int start, int len) +{ + u8 *p = map + BIT_BYTE(start); + const unsigned int size = start + len; + int bits_to_set = BITS_PER_BYTE - (start % BITS_PER_BYTE); + u8 mask_to_set = BITMAP_FIRST_BYTE_MASK(start); + + while (len - bits_to_set >= 0) { + *p |= mask_to_set; + len -= bits_to_set; + bits_to_set = BITS_PER_BYTE; + mask_to_set = ~0; + p++; + } + if (len) { + mask_to_set &= BITMAP_LAST_BYTE_MASK(size); + *p |= mask_to_set; + } +} + int convert_free_space_to_bitmaps(struct btrfs_trans_handle *trans, struct btrfs_fs_info *fs_info, struct btrfs_block_group_cache *block_group, |