mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 08:46:46 +00:00
btrfs: get next entry in tree_search_offset before doing checks
This is a small optimisation since the currently 'entry' is already checked in the if () {} else if {} construct above the loop. In essence the first iteration of the final while loop is redundant. To eliminate this extra check simply get the next entry at the beginning of the loop. 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
bbf27275f2
commit
167c0bd377
1 changed files with 4 additions and 5 deletions
|
@ -1730,6 +1730,10 @@ tree_search_offset(struct btrfs_free_space_ctl *ctl,
|
|||
return NULL;
|
||||
|
||||
while (1) {
|
||||
n = rb_next(&entry->offset_index);
|
||||
if (!n)
|
||||
return NULL;
|
||||
entry = rb_entry(n, struct btrfs_free_space, offset_index);
|
||||
if (entry->bitmap) {
|
||||
if (entry->offset + BITS_PER_BITMAP *
|
||||
ctl->unit > offset)
|
||||
|
@ -1738,11 +1742,6 @@ tree_search_offset(struct btrfs_free_space_ctl *ctl,
|
|||
if (entry->offset + entry->bytes > offset)
|
||||
break;
|
||||
}
|
||||
|
||||
n = rb_next(&entry->offset_index);
|
||||
if (!n)
|
||||
return NULL;
|
||||
entry = rb_entry(n, struct btrfs_free_space, offset_index);
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue