提交 f1a8fc62 编写于 作者: N Nikolay Borisov 提交者: David Sterba

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: NJosef Bacik <josef@toxicpanda.com>
Signed-off-by: NNikolay Borisov <nborisov@suse.com>
Signed-off-by: NDavid Sterba <dsterba@suse.com>
上级 bf08387f
...@@ -1636,15 +1636,10 @@ tree_search_offset(struct btrfs_free_space_ctl *ctl, ...@@ -1636,15 +1636,10 @@ tree_search_offset(struct btrfs_free_space_ctl *ctl,
u64 offset, int bitmap_only, int fuzzy) u64 offset, int bitmap_only, int fuzzy)
{ {
struct rb_node *n = ctl->free_space_offset.rb_node; 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' */ /* find entry that is closest to the 'offset' */
while (1) { while (n) {
if (!n) {
entry = NULL;
break;
}
entry = rb_entry(n, struct btrfs_free_space, offset_index); entry = rb_entry(n, struct btrfs_free_space, offset_index);
prev = entry; prev = entry;
...@@ -1654,6 +1649,8 @@ tree_search_offset(struct btrfs_free_space_ctl *ctl, ...@@ -1654,6 +1649,8 @@ tree_search_offset(struct btrfs_free_space_ctl *ctl,
n = n->rb_right; n = n->rb_right;
else else
break; break;
entry = NULL;
} }
if (bitmap_only) { if (bitmap_only) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册