mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 20:54:10 +08:00
btrfs: eliminate if in main loop in tree_search_offset
Reshuffle the code inside the first loop of tree_search_offset so that one if() is eliminated and the becomes more linear. Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
bf08387fb4
commit
f1a8fc6265
@ -1636,15 +1636,10 @@ tree_search_offset(struct btrfs_free_space_ctl *ctl,
|
||||
u64 offset, int bitmap_only, int fuzzy)
|
||||
{
|
||||
struct rb_node *n = ctl->free_space_offset.rb_node;
|
||||
struct btrfs_free_space *entry, *prev = NULL;
|
||||
struct btrfs_free_space *entry = NULL, *prev = NULL;
|
||||
|
||||
/* find entry that is closest to the 'offset' */
|
||||
while (1) {
|
||||
if (!n) {
|
||||
entry = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
while (n) {
|
||||
entry = rb_entry(n, struct btrfs_free_space, offset_index);
|
||||
prev = entry;
|
||||
|
||||
@ -1654,6 +1649,8 @@ tree_search_offset(struct btrfs_free_space_ctl *ctl,
|
||||
n = n->rb_right;
|
||||
else
|
||||
break;
|
||||
|
||||
entry = NULL;
|
||||
}
|
||||
|
||||
if (bitmap_only) {
|
||||
|
Loading…
Reference in New Issue
Block a user