Skip to content

Commit

Permalink
Btrfs: remove unnecessary ref heads rb tree search
Browse files Browse the repository at this point in the history
When we didn't find the exact ref head we were looking for, if
return_bigger != 0 we set a new search key to match either the
next node after the last one we found or the first one in the
ref heads rb tree, and then did another full tree search. For both
cases this ended up being pointless as we would end up returning
an entry we already had before repeating the search.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Josef Bacik <jbacik@fb.com>
  • Loading branch information
Filipe Manana authored and Josef Bacik committed Mar 10, 2014
1 parent 2c6a92b commit 6103fb4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions fs/btrfs/delayed-ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ find_ref_head(struct rb_root *root, u64 bytenr,
struct btrfs_delayed_ref_head *entry;
int cmp = 0;

again:
n = root->rb_node;
entry = NULL;
while (n) {
Expand Down Expand Up @@ -234,9 +233,9 @@ find_ref_head(struct rb_root *root, u64 bytenr,
n = rb_first(root);
entry = rb_entry(n, struct btrfs_delayed_ref_head,
href_node);
bytenr = entry->node.bytenr;
return_bigger = 0;
goto again;
if (last)
*last = entry;
return entry;
}
return entry;
}
Expand Down

0 comments on commit 6103fb4

Please sign in to comment.