Commit 0eb997bf authored by Filipe Manana's avatar Filipe Manana Committed by David Sterba

btrfs: remove search start argument from first_logical_byte()

The search start argument passed to first_logical_byte() is always 0, as
we always want to get the logical start address of the block group with
the lowest logical start address. So remove it, as not only it is not
necessary, it also makes the following patches that change the lock that
protects the red black tree of block groups from a spin lock to a
read/write lock.
Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 44e5801f
...@@ -2492,7 +2492,7 @@ static u64 get_alloc_profile_by_root(struct btrfs_root *root, int data) ...@@ -2492,7 +2492,7 @@ static u64 get_alloc_profile_by_root(struct btrfs_root *root, int data)
return ret; return ret;
} }
static u64 first_logical_byte(struct btrfs_fs_info *fs_info, u64 search_start) static u64 first_logical_byte(struct btrfs_fs_info *fs_info)
{ {
struct btrfs_block_group *cache; struct btrfs_block_group *cache;
u64 bytenr; u64 bytenr;
...@@ -2504,7 +2504,8 @@ static u64 first_logical_byte(struct btrfs_fs_info *fs_info, u64 search_start) ...@@ -2504,7 +2504,8 @@ static u64 first_logical_byte(struct btrfs_fs_info *fs_info, u64 search_start)
if (bytenr < (u64)-1) if (bytenr < (u64)-1)
return bytenr; return bytenr;
cache = btrfs_lookup_first_block_group(fs_info, search_start); /* Get the block group with the lowest logical start address. */
cache = btrfs_lookup_first_block_group(fs_info, 0);
if (!cache) if (!cache)
return 0; return 0;
...@@ -4267,7 +4268,7 @@ static noinline int find_free_extent(struct btrfs_root *root, ...@@ -4267,7 +4268,7 @@ static noinline int find_free_extent(struct btrfs_root *root,
return ret; return ret;
ffe_ctl->search_start = max(ffe_ctl->search_start, ffe_ctl->search_start = max(ffe_ctl->search_start,
first_logical_byte(fs_info, 0)); first_logical_byte(fs_info));
ffe_ctl->search_start = max(ffe_ctl->search_start, ffe_ctl->hint_byte); ffe_ctl->search_start = max(ffe_ctl->search_start, ffe_ctl->hint_byte);
if (ffe_ctl->search_start == ffe_ctl->hint_byte) { if (ffe_ctl->search_start == ffe_ctl->hint_byte) {
block_group = btrfs_lookup_block_group(fs_info, block_group = btrfs_lookup_block_group(fs_info,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment