slot = p->slots[level];
BUG_ON(btrfs_header_nritems(b) == 1);
}
+ unlock_up(p, level, lowest_unlock);
+
/* this is only true while dropping a snapshot */
if (level == lowest_level) {
- unlock_up(p, level, lowest_unlock);
break;
}
- if (should_reada)
- reada_for_search(root, p, level, slot,
- key->objectid);
-
blocknr = btrfs_node_blockptr(b, slot);
gen = btrfs_node_ptr_generation(b, slot);
blocksize = btrfs_level_size(root, level - 1);
btrfs_release_path(NULL, p);
if (tmp)
free_extent_buffer(tmp);
+ if (should_reada)
+ reada_for_search(root, p,
+ level, slot,
+ key->objectid);
+
tmp = read_tree_block(root, blocknr,
blocksize, gen);
if (tmp)
} else {
if (tmp)
free_extent_buffer(tmp);
+ if (should_reada)
+ reada_for_search(root, p,
+ level, slot,
+ key->objectid);
b = read_node_slot(root, b, slot);
}
}
if (!p->skip_locking)
btrfs_tree_lock(b);
- unlock_up(p, level, lowest_unlock);
} else {
p->slots[level] = slot;
if (ins_len > 0 && btrfs_leaf_free_space(root, b) <
int btrfs_tree_lock(struct extent_buffer *eb)
{
+ int i;
+
+ if (!TestSetPageLocked(eb->first_page))
+ return 0;
+ for (i = 0; i < 512; i++) {
+ cpu_relax();
+ if (!TestSetPageLocked(eb->first_page))
+ return 0;
+ }
+ cpu_relax();
lock_page(eb->first_page);
return 0;
}