Skip to content

Commit 2f83a82

Browse files
fdmananakdave
authored andcommitted
btrfs: rename free_space_set_bits() and make it less confusing
The free_space_set_bits() is used both to set a range of bits or to clear range of bits, depending on the 'bit' argument value. So the name is very misleading since it's not used only to set bits. Furthermore the 'bit' argument is an integer when a boolean is all that is needed plus its name is singular, which gives the idea the function operates on a single bit and not on a range of bits. So rename the function to free_space_modify_bits(), rename the 'bit' argument to 'set_bits' and turn the argument to bool instead of int. Reviewed-by: Boris Burkov <boris@bur.io> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 33523a0 commit 2f83a82

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

fs/btrfs/free-space-tree.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -535,10 +535,10 @@ bool btrfs_free_space_test_bit(struct btrfs_block_group *block_group,
535535
return extent_buffer_test_bit(leaf, ptr, i);
536536
}
537537

538-
static void free_space_set_bits(struct btrfs_trans_handle *trans,
539-
struct btrfs_block_group *block_group,
540-
struct btrfs_path *path, u64 *start, u64 *size,
541-
int bit)
538+
static void free_space_modify_bits(struct btrfs_trans_handle *trans,
539+
struct btrfs_block_group *block_group,
540+
struct btrfs_path *path, u64 *start, u64 *size,
541+
bool set_bits)
542542
{
543543
struct btrfs_fs_info *fs_info = block_group->fs_info;
544544
struct extent_buffer *leaf;
@@ -562,7 +562,7 @@ static void free_space_set_bits(struct btrfs_trans_handle *trans,
562562
ptr = btrfs_item_ptr_offset(leaf, path->slots[0]);
563563
first = (*start - found_start) >> fs_info->sectorsize_bits;
564564
last = (end - found_start) >> fs_info->sectorsize_bits;
565-
if (bit)
565+
if (set_bits)
566566
extent_buffer_bitmap_set(leaf, ptr, first, last - first);
567567
else
568568
extent_buffer_bitmap_clear(leaf, ptr, first, last - first);
@@ -658,8 +658,8 @@ static int modify_free_space_bitmap(struct btrfs_trans_handle *trans,
658658
cur_start = start;
659659
cur_size = size;
660660
while (1) {
661-
free_space_set_bits(trans, block_group, path, &cur_start, &cur_size,
662-
!remove);
661+
free_space_modify_bits(trans, block_group, path, &cur_start,
662+
&cur_size, !remove);
663663
if (cur_size == 0)
664664
break;
665665
ret = free_space_next_bitmap(trans, root, path);

0 commit comments

Comments
 (0)