Lines Matching refs:path
19 *root, struct btrfs_path *path, int level);
21 const struct btrfs_key *ins_key, struct btrfs_path *path,
29 static void del_ptr(struct btrfs_root *root, struct btrfs_path *path,
1268 tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct btrfs_path *path, in tree_mod_log_rewind() argument
1284 btrfs_set_path_blocking(path); in tree_mod_log_rewind()
1846 struct btrfs_path *path, int level) in balance_level() argument
1856 int orig_slot = path->slots[level]; in balance_level()
1861 mid = path->nodes[level]; in balance_level()
1863 WARN_ON(path->locks[level] != BTRFS_WRITE_LOCK && in balance_level()
1864 path->locks[level] != BTRFS_WRITE_LOCK_BLOCKING); in balance_level()
1870 parent = path->nodes[level + 1]; in balance_level()
1871 pslot = path->slots[level + 1]; in balance_level()
1909 path->locks[level] = 0; in balance_level()
1910 path->nodes[level] = NULL; in balance_level()
1976 del_ptr(root, path, level + 1, pslot + 1); in balance_level()
2021 del_ptr(root, path, level + 1, pslot); in balance_level()
2042 path->nodes[level] = left; in balance_level()
2043 path->slots[level + 1] -= 1; in balance_level()
2044 path->slots[level] = orig_slot; in balance_level()
2051 path->slots[level] = orig_slot; in balance_level()
2056 btrfs_node_blockptr(path->nodes[level], path->slots[level])) in balance_level()
2064 if (path->nodes[level] != left) in balance_level()
2077 struct btrfs_path *path, int level) in push_nodes_for_insert() argument
2087 int orig_slot = path->slots[level]; in push_nodes_for_insert()
2092 mid = path->nodes[level]; in push_nodes_for_insert()
2096 parent = path->nodes[level + 1]; in push_nodes_for_insert()
2097 pslot = path->slots[level + 1]; in push_nodes_for_insert()
2139 path->nodes[level] = left; in push_nodes_for_insert()
2140 path->slots[level + 1] -= 1; in push_nodes_for_insert()
2141 path->slots[level] = orig_slot; in push_nodes_for_insert()
2147 path->slots[level] = orig_slot; in push_nodes_for_insert()
2195 path->nodes[level] = right; in push_nodes_for_insert()
2196 path->slots[level + 1] += 1; in push_nodes_for_insert()
2197 path->slots[level] = orig_slot - in push_nodes_for_insert()
2218 struct btrfs_path *path, in reada_for_search() argument
2235 if (!path->nodes[level]) in reada_for_search()
2238 node = path->nodes[level]; in reada_for_search()
2254 if (path->reada == READA_BACK) { in reada_for_search()
2258 } else if (path->reada == READA_FORWARD) { in reada_for_search()
2263 if (path->reada == READA_BACK && objectid) { in reada_for_search()
2281 struct btrfs_path *path, int level) in reada_for_balance() argument
2291 parent = path->nodes[level + 1]; in reada_for_balance()
2296 slot = path->slots[level + 1]; in reada_for_balance()
2340 static noinline void unlock_up(struct btrfs_path *path, int level, in unlock_up() argument
2350 if (!path->nodes[i]) in unlock_up()
2352 if (!path->locks[i]) in unlock_up()
2354 if (!no_skips && path->slots[i] == 0) { in unlock_up()
2358 if (!no_skips && path->keep_locks) { in unlock_up()
2360 t = path->nodes[i]; in unlock_up()
2362 if (nritems < 1 || path->slots[i] >= nritems - 1) { in unlock_up()
2370 t = path->nodes[i]; in unlock_up()
2372 btrfs_tree_unlock_rw(t, path->locks[i]); in unlock_up()
2373 path->locks[i] = 0; in unlock_up()
2551 int btrfs_find_item(struct btrfs_root *fs_root, struct btrfs_path *path, in btrfs_find_item() argument
2559 ASSERT(path); in btrfs_find_item()
2566 ret = btrfs_search_slot(NULL, fs_root, &key, path, 0, 0); in btrfs_find_item()
2570 eb = path->nodes[0]; in btrfs_find_item()
2571 if (ret && path->slots[0] >= btrfs_header_nritems(eb)) { in btrfs_find_item()
2572 ret = btrfs_next_leaf(fs_root, path); in btrfs_find_item()
2575 eb = path->nodes[0]; in btrfs_find_item()
2578 btrfs_item_key_to_cpu(eb, found_key, path->slots[0]); in btrfs_find_item()
3145 static void fixup_low_keys(struct btrfs_path *path, in fixup_low_keys() argument
3153 int tslot = path->slots[i]; in fixup_low_keys()
3155 if (!path->nodes[i]) in fixup_low_keys()
3157 t = path->nodes[i]; in fixup_low_keys()
3162 btrfs_mark_buffer_dirty(path->nodes[i]); in fixup_low_keys()
3175 struct btrfs_path *path, in btrfs_set_item_key_safe() argument
3182 eb = path->nodes[0]; in btrfs_set_item_key_safe()
3183 slot = path->slots[0]; in btrfs_set_item_key_safe()
3217 fixup_low_keys(path, &disk_key, 1); in btrfs_set_item_key_safe()
3432 struct btrfs_path *path, int level) in insert_new_root() argument
3442 BUG_ON(path->nodes[level]); in insert_new_root()
3443 BUG_ON(path->nodes[level-1] != root->node); in insert_new_root()
3445 lower = path->nodes[level-1]; in insert_new_root()
3479 path->nodes[level] = c; in insert_new_root()
3480 path->locks[level] = BTRFS_WRITE_LOCK_BLOCKING; in insert_new_root()
3481 path->slots[level] = 0; in insert_new_root()
3493 struct btrfs_path *path, in insert_ptr() argument
3501 BUG_ON(!path->nodes[level]); in insert_ptr()
3502 btrfs_assert_tree_locked(path->nodes[level]); in insert_ptr()
3503 lower = path->nodes[level]; in insert_ptr()
3542 struct btrfs_path *path, int level) in split_node() argument
3552 c = path->nodes[level]; in split_node()
3565 ret = insert_new_root(trans, root, path, level + 1); in split_node()
3569 ret = push_nodes_for_insert(trans, root, path, level); in split_node()
3570 c = path->nodes[level]; in split_node()
3608 insert_ptr(trans, path, &disk_key, split->start, in split_node()
3609 path->slots[level + 1] + 1, level + 1); in split_node()
3611 if (path->slots[level] >= mid) { in split_node()
3612 path->slots[level] -= mid; in split_node()
3615 path->nodes[level] = split; in split_node()
3616 path->slots[level + 1] += 1; in split_node()
3675 static noinline int __push_leaf_right(struct btrfs_path *path, in __push_leaf_right() argument
3682 struct extent_buffer *left = path->nodes[0]; in __push_leaf_right()
3683 struct extent_buffer *upper = path->nodes[1]; in __push_leaf_right()
3701 if (path->slots[0] >= left_nritems) in __push_leaf_right()
3704 slot = path->slots[1]; in __push_leaf_right()
3710 if (path->slots[0] > i) in __push_leaf_right()
3712 if (path->slots[0] == i) { in __push_leaf_right()
3720 if (path->slots[0] == i) in __push_leaf_right()
3793 if (path->slots[0] >= left_nritems) { in __push_leaf_right()
3794 path->slots[0] -= left_nritems; in __push_leaf_right()
3795 if (btrfs_header_nritems(path->nodes[0]) == 0) in __push_leaf_right()
3796 btrfs_clean_tree_block(path->nodes[0]); in __push_leaf_right()
3797 btrfs_tree_unlock(path->nodes[0]); in __push_leaf_right()
3798 free_extent_buffer(path->nodes[0]); in __push_leaf_right()
3799 path->nodes[0] = right; in __push_leaf_right()
3800 path->slots[1] += 1; in __push_leaf_right()
3824 *root, struct btrfs_path *path, in push_leaf_right() argument
3828 struct extent_buffer *left = path->nodes[0]; in push_leaf_right()
3836 if (!path->nodes[1]) in push_leaf_right()
3839 slot = path->slots[1]; in push_leaf_right()
3840 upper = path->nodes[1]; in push_leaf_right()
3844 btrfs_assert_tree_locked(path->nodes[1]); in push_leaf_right()
3882 if (path->slots[0] == left_nritems && !empty) { in push_leaf_right()
3889 path->nodes[0] = right; in push_leaf_right()
3890 path->slots[0] = 0; in push_leaf_right()
3891 path->slots[1]++; in push_leaf_right()
3895 return __push_leaf_right(path, min_data_size, empty, in push_leaf_right()
3911 static noinline int __push_leaf_left(struct btrfs_path *path, int data_size, in __push_leaf_left() argument
3918 struct extent_buffer *right = path->nodes[0]; in __push_leaf_left()
3939 if (path->slots[0] < i) in __push_leaf_left()
3941 if (path->slots[0] == i) { in __push_leaf_left()
3949 if (path->slots[0] == i) in __push_leaf_left()
4033 fixup_low_keys(path, &disk_key, 1); in __push_leaf_left()
4036 if (path->slots[0] < push_items) { in __push_leaf_left()
4037 path->slots[0] += old_left_nritems; in __push_leaf_left()
4038 btrfs_tree_unlock(path->nodes[0]); in __push_leaf_left()
4039 free_extent_buffer(path->nodes[0]); in __push_leaf_left()
4040 path->nodes[0] = left; in __push_leaf_left()
4041 path->slots[1] -= 1; in __push_leaf_left()
4045 path->slots[0] -= push_items; in __push_leaf_left()
4047 BUG_ON(path->slots[0] < 0); in __push_leaf_left()
4064 *root, struct btrfs_path *path, int min_data_size, in push_leaf_left() argument
4067 struct extent_buffer *right = path->nodes[0]; in push_leaf_left()
4074 slot = path->slots[1]; in push_leaf_left()
4077 if (!path->nodes[1]) in push_leaf_left()
4084 btrfs_assert_tree_locked(path->nodes[1]); in push_leaf_left()
4086 left = btrfs_read_node_slot(path->nodes[1], slot - 1); in push_leaf_left()
4105 path->nodes[1], slot - 1, &left, in push_leaf_left()
4125 return __push_leaf_left(path, min_data_size, in push_leaf_left()
4139 struct btrfs_path *path, in copy_for_split() argument
4177 insert_ptr(trans, path, &disk_key, right->start, path->slots[1] + 1, 1); in copy_for_split()
4181 BUG_ON(path->slots[0] != slot); in copy_for_split()
4184 btrfs_tree_unlock(path->nodes[0]); in copy_for_split()
4185 free_extent_buffer(path->nodes[0]); in copy_for_split()
4186 path->nodes[0] = right; in copy_for_split()
4187 path->slots[0] -= mid; in copy_for_split()
4188 path->slots[1] += 1; in copy_for_split()
4194 BUG_ON(path->slots[0] < 0); in copy_for_split()
4209 struct btrfs_path *path, in push_for_double_split() argument
4218 slot = path->slots[0]; in push_for_double_split()
4219 if (slot < btrfs_header_nritems(path->nodes[0])) in push_for_double_split()
4220 space_needed -= btrfs_leaf_free_space(path->nodes[0]); in push_for_double_split()
4226 ret = push_leaf_right(trans, root, path, 1, space_needed, 0, slot); in push_for_double_split()
4233 nritems = btrfs_header_nritems(path->nodes[0]); in push_for_double_split()
4238 if (path->slots[0] == 0 || path->slots[0] == nritems) in push_for_double_split()
4241 if (btrfs_leaf_free_space(path->nodes[0]) >= data_size) in push_for_double_split()
4245 slot = path->slots[0]; in push_for_double_split()
4248 space_needed -= btrfs_leaf_free_space(path->nodes[0]); in push_for_double_split()
4249 ret = push_leaf_left(trans, root, path, 1, space_needed, 0, slot); in push_for_double_split()
4270 struct btrfs_path *path, int data_size, in split_leaf() argument
4286 l = path->nodes[0]; in split_leaf()
4287 slot = path->slots[0]; in split_leaf()
4293 if (data_size && path->nodes[1]) { in split_leaf()
4299 wret = push_leaf_right(trans, root, path, space_needed, in split_leaf()
4307 wret = push_leaf_left(trans, root, path, space_needed, in split_leaf()
4312 l = path->nodes[0]; in split_leaf()
4319 if (!path->nodes[1]) { in split_leaf()
4320 ret = insert_new_root(trans, root, path, 1); in split_leaf()
4326 l = path->nodes[0]; in split_leaf()
4327 slot = path->slots[0]; in split_leaf()
4393 insert_ptr(trans, path, &disk_key, in split_leaf()
4394 right->start, path->slots[1] + 1, 1); in split_leaf()
4395 btrfs_tree_unlock(path->nodes[0]); in split_leaf()
4396 free_extent_buffer(path->nodes[0]); in split_leaf()
4397 path->nodes[0] = right; in split_leaf()
4398 path->slots[0] = 0; in split_leaf()
4399 path->slots[1] += 1; in split_leaf()
4402 insert_ptr(trans, path, &disk_key, in split_leaf()
4403 right->start, path->slots[1], 1); in split_leaf()
4404 btrfs_tree_unlock(path->nodes[0]); in split_leaf()
4405 free_extent_buffer(path->nodes[0]); in split_leaf()
4406 path->nodes[0] = right; in split_leaf()
4407 path->slots[0] = 0; in split_leaf()
4408 if (path->slots[1] == 0) in split_leaf()
4409 fixup_low_keys(path, &disk_key, 1); in split_leaf()
4419 copy_for_split(trans, path, l, right, slot, mid, nritems); in split_leaf()
4430 push_for_double_split(trans, root, path, data_size); in split_leaf()
4432 if (btrfs_leaf_free_space(path->nodes[0]) >= data_size) in split_leaf()
4439 struct btrfs_path *path, int ins_len) in setup_leaf_for_split() argument
4448 leaf = path->nodes[0]; in setup_leaf_for_split()
4449 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in setup_leaf_for_split()
4457 item_size = btrfs_item_size_nr(leaf, path->slots[0]); in setup_leaf_for_split()
4459 fi = btrfs_item_ptr(leaf, path->slots[0], in setup_leaf_for_split()
4463 btrfs_release_path(path); in setup_leaf_for_split()
4465 path->keep_locks = 1; in setup_leaf_for_split()
4466 path->search_for_split = 1; in setup_leaf_for_split()
4467 ret = btrfs_search_slot(trans, root, &key, path, 0, 1); in setup_leaf_for_split()
4468 path->search_for_split = 0; in setup_leaf_for_split()
4475 leaf = path->nodes[0]; in setup_leaf_for_split()
4477 if (item_size != btrfs_item_size_nr(leaf, path->slots[0])) in setup_leaf_for_split()
4481 if (btrfs_leaf_free_space(path->nodes[0]) >= ins_len) in setup_leaf_for_split()
4485 fi = btrfs_item_ptr(leaf, path->slots[0], in setup_leaf_for_split()
4491 btrfs_set_path_blocking(path); in setup_leaf_for_split()
4492 ret = split_leaf(trans, root, &key, path, ins_len, 1); in setup_leaf_for_split()
4496 path->keep_locks = 0; in setup_leaf_for_split()
4497 btrfs_unlock_up_safe(path, 1); in setup_leaf_for_split()
4500 path->keep_locks = 0; in setup_leaf_for_split()
4504 static noinline int split_item(struct btrfs_path *path, in split_item() argument
4518 leaf = path->nodes[0]; in split_item()
4521 btrfs_set_path_blocking(path); in split_item()
4523 item = btrfs_item_nr(path->slots[0]); in split_item()
4532 path->slots[0]), item_size); in split_item()
4534 slot = path->slots[0] + 1; in split_item()
4559 btrfs_item_ptr_offset(leaf, path->slots[0]), in split_item()
4590 struct btrfs_path *path, in btrfs_split_item() argument
4595 ret = setup_leaf_for_split(trans, root, path, in btrfs_split_item()
4600 ret = split_item(path, new_key, split_offset); in btrfs_split_item()
4614 struct btrfs_path *path, in btrfs_duplicate_item() argument
4621 leaf = path->nodes[0]; in btrfs_duplicate_item()
4622 item_size = btrfs_item_size_nr(leaf, path->slots[0]); in btrfs_duplicate_item()
4623 ret = setup_leaf_for_split(trans, root, path, in btrfs_duplicate_item()
4628 path->slots[0]++; in btrfs_duplicate_item()
4629 setup_items_for_insert(root, path, new_key, &item_size, 1); in btrfs_duplicate_item()
4630 leaf = path->nodes[0]; in btrfs_duplicate_item()
4632 btrfs_item_ptr_offset(leaf, path->slots[0]), in btrfs_duplicate_item()
4633 btrfs_item_ptr_offset(leaf, path->slots[0] - 1), in btrfs_duplicate_item()
4644 void btrfs_truncate_item(struct btrfs_path *path, u32 new_size, int from_end) in btrfs_truncate_item() argument
4657 leaf = path->nodes[0]; in btrfs_truncate_item()
4658 slot = path->slots[0]; in btrfs_truncate_item()
4724 fixup_low_keys(path, &disk_key, 1); in btrfs_truncate_item()
4740 void btrfs_extend_item(struct btrfs_path *path, u32 data_size) in btrfs_extend_item() argument
4752 leaf = path->nodes[0]; in btrfs_extend_item()
4761 slot = path->slots[0]; in btrfs_extend_item()
4813 void setup_items_for_insert(struct btrfs_root *root, struct btrfs_path *path, in setup_items_for_insert() argument
4833 if (path->slots[0] == 0) { in setup_items_for_insert()
4835 fixup_low_keys(path, &disk_key, 1); in setup_items_for_insert()
4837 btrfs_unlock_up_safe(path, 1); in setup_items_for_insert()
4839 leaf = path->nodes[0]; in setup_items_for_insert()
4840 slot = path->slots[0]; in setup_items_for_insert()
4912 struct btrfs_path *path, in btrfs_insert_empty_items() argument
4926 ret = btrfs_search_slot(trans, root, cpu_key, path, total_size, 1); in btrfs_insert_empty_items()
4932 slot = path->slots[0]; in btrfs_insert_empty_items()
4935 setup_items_for_insert(root, path, cpu_key, data_size, nr); in btrfs_insert_empty_items()
4948 struct btrfs_path *path; in btrfs_insert_item() local
4952 path = btrfs_alloc_path(); in btrfs_insert_item()
4953 if (!path) in btrfs_insert_item()
4955 ret = btrfs_insert_empty_item(trans, root, path, cpu_key, data_size); in btrfs_insert_item()
4957 leaf = path->nodes[0]; in btrfs_insert_item()
4958 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]); in btrfs_insert_item()
4962 btrfs_free_path(path); in btrfs_insert_item()
4972 static void del_ptr(struct btrfs_root *root, struct btrfs_path *path, in del_ptr() argument
4975 struct extent_buffer *parent = path->nodes[level]; in del_ptr()
5007 fixup_low_keys(path, &disk_key, level + 1); in del_ptr()
5024 struct btrfs_path *path, in btrfs_del_leaf() argument
5028 del_ptr(root, path, 1, path->slots[1]); in btrfs_del_leaf()
5034 btrfs_unlock_up_safe(path, 0); in btrfs_del_leaf()
5047 struct btrfs_path *path, int slot, int nr) in btrfs_del_items() argument
5059 leaf = path->nodes[0]; in btrfs_del_items()
5098 btrfs_set_path_blocking(path); in btrfs_del_items()
5100 btrfs_del_leaf(trans, root, path, leaf); in btrfs_del_items()
5108 fixup_low_keys(path, &disk_key, 1); in btrfs_del_items()
5117 slot = path->slots[1]; in btrfs_del_items()
5120 btrfs_set_path_blocking(path); in btrfs_del_items()
5121 wret = push_leaf_left(trans, root, path, 1, 1, in btrfs_del_items()
5126 if (path->nodes[0] == leaf && in btrfs_del_items()
5128 wret = push_leaf_right(trans, root, path, 1, in btrfs_del_items()
5135 path->slots[1] = slot; in btrfs_del_items()
5136 btrfs_del_leaf(trans, root, path, leaf); in btrfs_del_items()
5145 if (path->nodes[0] == leaf) in btrfs_del_items()
5164 int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path) in btrfs_prev_leaf() argument
5171 btrfs_item_key_to_cpu(path->nodes[0], &key, 0); in btrfs_prev_leaf()
5187 btrfs_release_path(path); in btrfs_prev_leaf()
5188 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_prev_leaf()
5203 if (path->slots[0] < btrfs_header_nritems(path->nodes[0])) { in btrfs_prev_leaf()
5204 btrfs_item_key(path->nodes[0], &found_key, path->slots[0]); in btrfs_prev_leaf()
5207 if (path->slots[0] > 0) { in btrfs_prev_leaf()
5208 path->slots[0]--; in btrfs_prev_leaf()
5219 btrfs_item_key(path->nodes[0], &found_key, 0); in btrfs_prev_leaf()
5256 struct btrfs_path *path, in btrfs_search_forward() argument
5266 int keep_locks = path->keep_locks; in btrfs_search_forward()
5268 path->keep_locks = 1; in btrfs_search_forward()
5272 WARN_ON(path->nodes[level]); in btrfs_search_forward()
5273 path->nodes[level] = cur; in btrfs_search_forward()
5274 path->locks[level] = BTRFS_READ_LOCK; in btrfs_search_forward()
5290 if (level == path->lowest_level) { in btrfs_search_forward()
5294 path->slots[level] = slot; in btrfs_search_forward()
5320 path->slots[level] = slot; in btrfs_search_forward()
5321 btrfs_set_path_blocking(path); in btrfs_search_forward()
5322 sret = btrfs_find_next_key(root, path, min_key, level, in btrfs_search_forward()
5325 btrfs_release_path(path); in btrfs_search_forward()
5333 path->slots[level] = slot; in btrfs_search_forward()
5334 if (level == path->lowest_level) { in btrfs_search_forward()
5338 btrfs_set_path_blocking(path); in btrfs_search_forward()
5347 path->locks[level - 1] = BTRFS_READ_LOCK; in btrfs_search_forward()
5348 path->nodes[level - 1] = cur; in btrfs_search_forward()
5349 unlock_up(path, level, 1, 0, NULL); in btrfs_search_forward()
5352 path->keep_locks = keep_locks; in btrfs_search_forward()
5354 btrfs_unlock_up_safe(path, path->lowest_level + 1); in btrfs_search_forward()
5355 btrfs_set_path_blocking(path); in btrfs_search_forward()
5372 int btrfs_find_next_key(struct btrfs_root *root, struct btrfs_path *path, in btrfs_find_next_key() argument
5378 WARN_ON(!path->keep_locks && !path->skip_locking); in btrfs_find_next_key()
5380 if (!path->nodes[level]) in btrfs_find_next_key()
5383 slot = path->slots[level] + 1; in btrfs_find_next_key()
5384 c = path->nodes[level]; in btrfs_find_next_key()
5391 !path->nodes[level + 1]) in btrfs_find_next_key()
5394 if (path->locks[level + 1] || path->skip_locking) { in btrfs_find_next_key()
5405 orig_lowest = path->lowest_level; in btrfs_find_next_key()
5406 btrfs_release_path(path); in btrfs_find_next_key()
5407 path->lowest_level = level; in btrfs_find_next_key()
5408 ret = btrfs_search_slot(NULL, root, &cur_key, path, in btrfs_find_next_key()
5410 path->lowest_level = orig_lowest; in btrfs_find_next_key()
5414 c = path->nodes[level]; in btrfs_find_next_key()
5415 slot = path->slots[level]; in btrfs_find_next_key()
5442 int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path) in btrfs_next_leaf() argument
5444 return btrfs_next_old_leaf(root, path, 0); in btrfs_next_leaf()
5447 int btrfs_next_old_leaf(struct btrfs_root *root, struct btrfs_path *path, in btrfs_next_old_leaf() argument
5457 int old_spinning = path->leave_spinning; in btrfs_next_old_leaf()
5460 nritems = btrfs_header_nritems(path->nodes[0]); in btrfs_next_old_leaf()
5464 btrfs_item_key_to_cpu(path->nodes[0], &key, nritems - 1); in btrfs_next_old_leaf()
5469 btrfs_release_path(path); in btrfs_next_old_leaf()
5471 path->keep_locks = 1; in btrfs_next_old_leaf()
5472 path->leave_spinning = 1; in btrfs_next_old_leaf()
5475 ret = btrfs_search_old_slot(root, &key, path, time_seq); in btrfs_next_old_leaf()
5477 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_next_old_leaf()
5478 path->keep_locks = 0; in btrfs_next_old_leaf()
5483 nritems = btrfs_header_nritems(path->nodes[0]); in btrfs_next_old_leaf()
5490 if (nritems > 0 && path->slots[0] < nritems - 1) { in btrfs_next_old_leaf()
5492 path->slots[0]++; in btrfs_next_old_leaf()
5510 if (nritems > 0 && ret > 0 && path->slots[0] == nritems - 1) { in btrfs_next_old_leaf()
5516 if (!path->nodes[level]) { in btrfs_next_old_leaf()
5521 slot = path->slots[level] + 1; in btrfs_next_old_leaf()
5522 c = path->nodes[level]; in btrfs_next_old_leaf()
5538 next_rw_lock = path->locks[level]; in btrfs_next_old_leaf()
5539 ret = read_block_for_search(root, path, &next, level, in btrfs_next_old_leaf()
5545 btrfs_release_path(path); in btrfs_next_old_leaf()
5549 if (!path->skip_locking) { in btrfs_next_old_leaf()
5560 btrfs_release_path(path); in btrfs_next_old_leaf()
5565 btrfs_set_path_blocking(path); in btrfs_next_old_leaf()
5568 path->recurse); in btrfs_next_old_leaf()
5574 path->slots[level] = slot; in btrfs_next_old_leaf()
5577 c = path->nodes[level]; in btrfs_next_old_leaf()
5578 if (path->locks[level]) in btrfs_next_old_leaf()
5579 btrfs_tree_unlock_rw(c, path->locks[level]); in btrfs_next_old_leaf()
5582 path->nodes[level] = next; in btrfs_next_old_leaf()
5583 path->slots[level] = 0; in btrfs_next_old_leaf()
5584 if (!path->skip_locking) in btrfs_next_old_leaf()
5585 path->locks[level] = next_rw_lock; in btrfs_next_old_leaf()
5589 ret = read_block_for_search(root, path, &next, level, in btrfs_next_old_leaf()
5595 btrfs_release_path(path); in btrfs_next_old_leaf()
5599 if (!path->skip_locking) { in btrfs_next_old_leaf()
5602 btrfs_set_path_blocking(path); in btrfs_next_old_leaf()
5605 path->recurse); in btrfs_next_old_leaf()
5612 unlock_up(path, 0, 1, 0, NULL); in btrfs_next_old_leaf()
5613 path->leave_spinning = old_spinning; in btrfs_next_old_leaf()
5615 btrfs_set_path_blocking(path); in btrfs_next_old_leaf()
5627 struct btrfs_path *path, u64 min_objectid, in btrfs_previous_item() argument
5636 if (path->slots[0] == 0) { in btrfs_previous_item()
5637 btrfs_set_path_blocking(path); in btrfs_previous_item()
5638 ret = btrfs_prev_leaf(root, path); in btrfs_previous_item()
5642 path->slots[0]--; in btrfs_previous_item()
5644 leaf = path->nodes[0]; in btrfs_previous_item()
5648 if (path->slots[0] == nritems) in btrfs_previous_item()
5649 path->slots[0]--; in btrfs_previous_item()
5651 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_previous_item()
5670 struct btrfs_path *path, u64 min_objectid) in btrfs_previous_extent_item() argument
5678 if (path->slots[0] == 0) { in btrfs_previous_extent_item()
5679 btrfs_set_path_blocking(path); in btrfs_previous_extent_item()
5680 ret = btrfs_prev_leaf(root, path); in btrfs_previous_extent_item()
5684 path->slots[0]--; in btrfs_previous_extent_item()
5686 leaf = path->nodes[0]; in btrfs_previous_extent_item()
5690 if (path->slots[0] == nritems) in btrfs_previous_extent_item()
5691 path->slots[0]--; in btrfs_previous_extent_item()
5693 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_previous_extent_item()