aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/delayed-ref.c
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@gmail.com>2014-02-12 10:07:52 -0500
committerJosef Bacik <jbacik@fb.com>2014-03-10 15:16:46 -0400
commit6103fb43fbc6d1caa78f26a1d0aa3d1a4525cea5 (patch)
treeff21403bb6f11fe1ae08f948c36f30d69032e485 /fs/btrfs/delayed-ref.c
parent2c6a92b0097464e08caaa1caeb8baa9d470ab990 (diff)
Btrfs: remove unnecessary ref heads rb tree search
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>
Diffstat (limited to 'fs/btrfs/delayed-ref.c')
-rw-r--r--fs/btrfs/delayed-ref.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index f3bff89eecf0..56cdfe988d69 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -205,7 +205,6 @@ find_ref_head(struct rb_root *root, u64 bytenr,
205 struct btrfs_delayed_ref_head *entry; 205 struct btrfs_delayed_ref_head *entry;
206 int cmp = 0; 206 int cmp = 0;
207 207
208again:
209 n = root->rb_node; 208 n = root->rb_node;
210 entry = NULL; 209 entry = NULL;
211 while (n) { 210 while (n) {
@@ -234,9 +233,9 @@ again:
234 n = rb_first(root); 233 n = rb_first(root);
235 entry = rb_entry(n, struct btrfs_delayed_ref_head, 234 entry = rb_entry(n, struct btrfs_delayed_ref_head,
236 href_node); 235 href_node);
237 bytenr = entry->node.bytenr; 236 if (last)
238 return_bigger = 0; 237 *last = entry;
239 goto again; 238 return entry;
240 } 239 }
241 return entry; 240 return entry;
242 } 241 }