• Home
  • Raw
  • Download

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,
1302 tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct btrfs_path *path, in tree_mod_log_rewind() argument
1318 btrfs_set_path_blocking(path); in tree_mod_log_rewind()
1848 struct btrfs_path *path, int level) in balance_level() argument
1858 int orig_slot = path->slots[level]; in balance_level()
1863 mid = path->nodes[level]; in balance_level()
1865 WARN_ON(path->locks[level] != BTRFS_WRITE_LOCK && in balance_level()
1866 path->locks[level] != BTRFS_WRITE_LOCK_BLOCKING); in balance_level()
1872 parent = path->nodes[level + 1]; in balance_level()
1873 pslot = path->slots[level + 1]; in balance_level()
1910 path->locks[level] = 0; in balance_level()
1911 path->nodes[level] = NULL; in balance_level()
1975 del_ptr(root, path, level + 1, pslot + 1); in balance_level()
2020 del_ptr(root, path, level + 1, pslot); in balance_level()
2041 path->nodes[level] = left; in balance_level()
2042 path->slots[level + 1] -= 1; in balance_level()
2043 path->slots[level] = orig_slot; in balance_level()
2050 path->slots[level] = orig_slot; in balance_level()
2055 btrfs_node_blockptr(path->nodes[level], path->slots[level])) in balance_level()
2063 if (path->nodes[level] != left) in balance_level()
2076 struct btrfs_path *path, int level) in push_nodes_for_insert() argument
2086 int orig_slot = path->slots[level]; in push_nodes_for_insert()
2091 mid = path->nodes[level]; in push_nodes_for_insert()
2095 parent = path->nodes[level + 1]; in push_nodes_for_insert()
2096 pslot = path->slots[level + 1]; in push_nodes_for_insert()
2137 path->nodes[level] = left; in push_nodes_for_insert()
2138 path->slots[level + 1] -= 1; in push_nodes_for_insert()
2139 path->slots[level] = orig_slot; in push_nodes_for_insert()
2145 path->slots[level] = orig_slot; in push_nodes_for_insert()
2193 path->nodes[level] = right; in push_nodes_for_insert()
2194 path->slots[level + 1] += 1; in push_nodes_for_insert()
2195 path->slots[level] = orig_slot - in push_nodes_for_insert()
2216 struct btrfs_path *path, in reada_for_search() argument
2233 if (!path->nodes[level]) in reada_for_search()
2236 node = path->nodes[level]; in reada_for_search()
2252 if (path->reada == READA_BACK) { in reada_for_search()
2256 } else if (path->reada == READA_FORWARD) { in reada_for_search()
2261 if (path->reada == READA_BACK && objectid) { in reada_for_search()
2279 struct btrfs_path *path, int level) in reada_for_balance() argument
2289 parent = path->nodes[level + 1]; in reada_for_balance()
2294 slot = path->slots[level + 1]; in reada_for_balance()
2338 static noinline void unlock_up(struct btrfs_path *path, int level, in unlock_up() argument
2348 if (!path->nodes[i]) in unlock_up()
2350 if (!path->locks[i]) in unlock_up()
2352 if (!no_skips && path->slots[i] == 0) { in unlock_up()
2356 if (!no_skips && path->keep_locks) { in unlock_up()
2358 t = path->nodes[i]; in unlock_up()
2360 if (nritems < 1 || path->slots[i] >= nritems - 1) { in unlock_up()
2368 t = path->nodes[i]; in unlock_up()
2370 btrfs_tree_unlock_rw(t, path->locks[i]); in unlock_up()
2371 path->locks[i] = 0; in unlock_up()
2390 noinline void btrfs_unlock_up_safe(struct btrfs_path *path, int level) in btrfs_unlock_up_safe() argument
2394 if (path->keep_locks) in btrfs_unlock_up_safe()
2398 if (!path->nodes[i]) in btrfs_unlock_up_safe()
2400 if (!path->locks[i]) in btrfs_unlock_up_safe()
2402 btrfs_tree_unlock_rw(path->nodes[i], path->locks[i]); in btrfs_unlock_up_safe()
2403 path->locks[i] = 0; in btrfs_unlock_up_safe()
2589 int btrfs_find_item(struct btrfs_root *fs_root, struct btrfs_path *path, in btrfs_find_item() argument
2597 ASSERT(path); in btrfs_find_item()
2604 ret = btrfs_search_slot(NULL, fs_root, &key, path, 0, 0); in btrfs_find_item()
2608 eb = path->nodes[0]; in btrfs_find_item()
2609 if (ret && path->slots[0] >= btrfs_header_nritems(eb)) { in btrfs_find_item()
2610 ret = btrfs_next_leaf(fs_root, path); in btrfs_find_item()
2613 eb = path->nodes[0]; in btrfs_find_item()
2616 btrfs_item_key_to_cpu(eb, found_key, path->slots[0]); in btrfs_find_item()
3168 static void fixup_low_keys(struct btrfs_path *path, in fixup_low_keys() argument
3176 int tslot = path->slots[i]; in fixup_low_keys()
3178 if (!path->nodes[i]) in fixup_low_keys()
3180 t = path->nodes[i]; in fixup_low_keys()
3185 btrfs_mark_buffer_dirty(path->nodes[i]); in fixup_low_keys()
3198 struct btrfs_path *path, in btrfs_set_item_key_safe() argument
3205 eb = path->nodes[0]; in btrfs_set_item_key_safe()
3206 slot = path->slots[0]; in btrfs_set_item_key_safe()
3240 fixup_low_keys(path, &disk_key, 1); in btrfs_set_item_key_safe()
3391 struct btrfs_path *path, int level) in insert_new_root() argument
3401 BUG_ON(path->nodes[level]); in insert_new_root()
3402 BUG_ON(path->nodes[level-1] != root->node); in insert_new_root()
3404 lower = path->nodes[level-1]; in insert_new_root()
3437 path->nodes[level] = c; in insert_new_root()
3438 path->locks[level] = BTRFS_WRITE_LOCK_BLOCKING; in insert_new_root()
3439 path->slots[level] = 0; in insert_new_root()
3451 struct btrfs_path *path, in insert_ptr() argument
3459 BUG_ON(!path->nodes[level]); in insert_ptr()
3460 btrfs_assert_tree_locked(path->nodes[level]); in insert_ptr()
3461 lower = path->nodes[level]; in insert_ptr()
3500 struct btrfs_path *path, int level) in split_node() argument
3510 c = path->nodes[level]; in split_node()
3523 ret = insert_new_root(trans, root, path, level + 1); in split_node()
3527 ret = push_nodes_for_insert(trans, root, path, level); in split_node()
3528 c = path->nodes[level]; in split_node()
3564 insert_ptr(trans, path, &disk_key, split->start, in split_node()
3565 path->slots[level + 1] + 1, level + 1); in split_node()
3567 if (path->slots[level] >= mid) { in split_node()
3568 path->slots[level] -= mid; in split_node()
3571 path->nodes[level] = split; in split_node()
3572 path->slots[level + 1] += 1; in split_node()
3633 static noinline int __push_leaf_right(struct btrfs_path *path, in __push_leaf_right() argument
3640 struct extent_buffer *left = path->nodes[0]; in __push_leaf_right()
3641 struct extent_buffer *upper = path->nodes[1]; in __push_leaf_right()
3659 if (path->slots[0] >= left_nritems) in __push_leaf_right()
3662 slot = path->slots[1]; in __push_leaf_right()
3668 if (path->slots[0] > i) in __push_leaf_right()
3670 if (path->slots[0] == i) { in __push_leaf_right()
3678 if (path->slots[0] == i) in __push_leaf_right()
3751 if (path->slots[0] >= left_nritems) { in __push_leaf_right()
3752 path->slots[0] -= left_nritems; in __push_leaf_right()
3753 if (btrfs_header_nritems(path->nodes[0]) == 0) in __push_leaf_right()
3754 btrfs_clean_tree_block(path->nodes[0]); in __push_leaf_right()
3755 btrfs_tree_unlock(path->nodes[0]); in __push_leaf_right()
3756 free_extent_buffer(path->nodes[0]); in __push_leaf_right()
3757 path->nodes[0] = right; in __push_leaf_right()
3758 path->slots[1] += 1; in __push_leaf_right()
3782 *root, struct btrfs_path *path, in push_leaf_right() argument
3786 struct extent_buffer *left = path->nodes[0]; in push_leaf_right()
3794 if (!path->nodes[1]) in push_leaf_right()
3797 slot = path->slots[1]; in push_leaf_right()
3798 upper = path->nodes[1]; in push_leaf_right()
3802 btrfs_assert_tree_locked(path->nodes[1]); in push_leaf_right()
3833 if (path->slots[0] == left_nritems && !empty) { in push_leaf_right()
3840 path->nodes[0] = right; in push_leaf_right()
3841 path->slots[0] = 0; in push_leaf_right()
3842 path->slots[1]++; in push_leaf_right()
3846 return __push_leaf_right(path, min_data_size, empty, in push_leaf_right()
3862 static noinline int __push_leaf_left(struct btrfs_path *path, int data_size, in __push_leaf_left() argument
3869 struct extent_buffer *right = path->nodes[0]; in __push_leaf_left()
3890 if (path->slots[0] < i) in __push_leaf_left()
3892 if (path->slots[0] == i) { in __push_leaf_left()
3900 if (path->slots[0] == i) in __push_leaf_left()
3986 fixup_low_keys(path, &disk_key, 1); in __push_leaf_left()
3989 if (path->slots[0] < push_items) { in __push_leaf_left()
3990 path->slots[0] += old_left_nritems; in __push_leaf_left()
3991 btrfs_tree_unlock(path->nodes[0]); in __push_leaf_left()
3992 free_extent_buffer(path->nodes[0]); in __push_leaf_left()
3993 path->nodes[0] = left; in __push_leaf_left()
3994 path->slots[1] -= 1; in __push_leaf_left()
3998 path->slots[0] -= push_items; in __push_leaf_left()
4000 BUG_ON(path->slots[0] < 0); in __push_leaf_left()
4017 *root, struct btrfs_path *path, int min_data_size, in push_leaf_left() argument
4020 struct extent_buffer *right = path->nodes[0]; in push_leaf_left()
4027 slot = path->slots[1]; in push_leaf_left()
4030 if (!path->nodes[1]) in push_leaf_left()
4037 btrfs_assert_tree_locked(path->nodes[1]); in push_leaf_left()
4039 left = btrfs_read_node_slot(path->nodes[1], slot - 1); in push_leaf_left()
4058 path->nodes[1], slot - 1, &left); in push_leaf_left()
4072 return __push_leaf_left(path, min_data_size, in push_leaf_left()
4086 struct btrfs_path *path, in copy_for_split() argument
4125 insert_ptr(trans, path, &disk_key, right->start, path->slots[1] + 1, 1); in copy_for_split()
4129 BUG_ON(path->slots[0] != slot); in copy_for_split()
4132 btrfs_tree_unlock(path->nodes[0]); in copy_for_split()
4133 free_extent_buffer(path->nodes[0]); in copy_for_split()
4134 path->nodes[0] = right; in copy_for_split()
4135 path->slots[0] -= mid; in copy_for_split()
4136 path->slots[1] += 1; in copy_for_split()
4142 BUG_ON(path->slots[0] < 0); in copy_for_split()
4157 struct btrfs_path *path, in push_for_double_split() argument
4166 slot = path->slots[0]; in push_for_double_split()
4167 if (slot < btrfs_header_nritems(path->nodes[0])) in push_for_double_split()
4168 space_needed -= btrfs_leaf_free_space(path->nodes[0]); in push_for_double_split()
4174 ret = push_leaf_right(trans, root, path, 1, space_needed, 0, slot); in push_for_double_split()
4181 nritems = btrfs_header_nritems(path->nodes[0]); in push_for_double_split()
4186 if (path->slots[0] == 0 || path->slots[0] == nritems) in push_for_double_split()
4189 if (btrfs_leaf_free_space(path->nodes[0]) >= data_size) in push_for_double_split()
4193 slot = path->slots[0]; in push_for_double_split()
4196 space_needed -= btrfs_leaf_free_space(path->nodes[0]); in push_for_double_split()
4197 ret = push_leaf_left(trans, root, path, 1, space_needed, 0, slot); in push_for_double_split()
4218 struct btrfs_path *path, int data_size, in split_leaf() argument
4234 l = path->nodes[0]; in split_leaf()
4235 slot = path->slots[0]; in split_leaf()
4241 if (data_size && path->nodes[1]) { in split_leaf()
4247 wret = push_leaf_right(trans, root, path, space_needed, in split_leaf()
4255 wret = push_leaf_left(trans, root, path, space_needed, in split_leaf()
4260 l = path->nodes[0]; in split_leaf()
4267 if (!path->nodes[1]) { in split_leaf()
4268 ret = insert_new_root(trans, root, path, 1); in split_leaf()
4274 l = path->nodes[0]; in split_leaf()
4275 slot = path->slots[0]; in split_leaf()
4331 insert_ptr(trans, path, &disk_key, in split_leaf()
4332 right->start, path->slots[1] + 1, 1); in split_leaf()
4333 btrfs_tree_unlock(path->nodes[0]); in split_leaf()
4334 free_extent_buffer(path->nodes[0]); in split_leaf()
4335 path->nodes[0] = right; in split_leaf()
4336 path->slots[0] = 0; in split_leaf()
4337 path->slots[1] += 1; in split_leaf()
4340 insert_ptr(trans, path, &disk_key, in split_leaf()
4341 right->start, path->slots[1], 1); in split_leaf()
4342 btrfs_tree_unlock(path->nodes[0]); in split_leaf()
4343 free_extent_buffer(path->nodes[0]); in split_leaf()
4344 path->nodes[0] = right; in split_leaf()
4345 path->slots[0] = 0; in split_leaf()
4346 if (path->slots[1] == 0) in split_leaf()
4347 fixup_low_keys(path, &disk_key, 1); in split_leaf()
4357 copy_for_split(trans, path, l, right, slot, mid, nritems); in split_leaf()
4368 push_for_double_split(trans, root, path, data_size); in split_leaf()
4370 if (btrfs_leaf_free_space(path->nodes[0]) >= data_size) in split_leaf()
4377 struct btrfs_path *path, int ins_len) in setup_leaf_for_split() argument
4386 leaf = path->nodes[0]; in setup_leaf_for_split()
4387 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in setup_leaf_for_split()
4395 item_size = btrfs_item_size_nr(leaf, path->slots[0]); in setup_leaf_for_split()
4397 fi = btrfs_item_ptr(leaf, path->slots[0], in setup_leaf_for_split()
4401 btrfs_release_path(path); in setup_leaf_for_split()
4403 path->keep_locks = 1; in setup_leaf_for_split()
4404 path->search_for_split = 1; in setup_leaf_for_split()
4405 ret = btrfs_search_slot(trans, root, &key, path, 0, 1); in setup_leaf_for_split()
4406 path->search_for_split = 0; in setup_leaf_for_split()
4413 leaf = path->nodes[0]; in setup_leaf_for_split()
4415 if (item_size != btrfs_item_size_nr(leaf, path->slots[0])) in setup_leaf_for_split()
4419 if (btrfs_leaf_free_space(path->nodes[0]) >= ins_len) in setup_leaf_for_split()
4423 fi = btrfs_item_ptr(leaf, path->slots[0], in setup_leaf_for_split()
4429 btrfs_set_path_blocking(path); in setup_leaf_for_split()
4430 ret = split_leaf(trans, root, &key, path, ins_len, 1); in setup_leaf_for_split()
4434 path->keep_locks = 0; in setup_leaf_for_split()
4435 btrfs_unlock_up_safe(path, 1); in setup_leaf_for_split()
4438 path->keep_locks = 0; in setup_leaf_for_split()
4442 static noinline int split_item(struct btrfs_path *path, in split_item() argument
4456 leaf = path->nodes[0]; in split_item()
4459 btrfs_set_path_blocking(path); in split_item()
4461 item = btrfs_item_nr(path->slots[0]); in split_item()
4470 path->slots[0]), item_size); in split_item()
4472 slot = path->slots[0] + 1; in split_item()
4497 btrfs_item_ptr_offset(leaf, path->slots[0]), in split_item()
4528 struct btrfs_path *path, in btrfs_split_item() argument
4533 ret = setup_leaf_for_split(trans, root, path, in btrfs_split_item()
4538 ret = split_item(path, new_key, split_offset); in btrfs_split_item()
4552 struct btrfs_path *path, in btrfs_duplicate_item() argument
4559 leaf = path->nodes[0]; in btrfs_duplicate_item()
4560 item_size = btrfs_item_size_nr(leaf, path->slots[0]); in btrfs_duplicate_item()
4561 ret = setup_leaf_for_split(trans, root, path, in btrfs_duplicate_item()
4566 path->slots[0]++; in btrfs_duplicate_item()
4567 setup_items_for_insert(root, path, new_key, &item_size, in btrfs_duplicate_item()
4570 leaf = path->nodes[0]; in btrfs_duplicate_item()
4572 btrfs_item_ptr_offset(leaf, path->slots[0]), in btrfs_duplicate_item()
4573 btrfs_item_ptr_offset(leaf, path->slots[0] - 1), in btrfs_duplicate_item()
4584 void btrfs_truncate_item(struct btrfs_path *path, u32 new_size, int from_end) in btrfs_truncate_item() argument
4597 leaf = path->nodes[0]; in btrfs_truncate_item()
4598 slot = path->slots[0]; in btrfs_truncate_item()
4665 fixup_low_keys(path, &disk_key, 1); in btrfs_truncate_item()
4681 void btrfs_extend_item(struct btrfs_path *path, u32 data_size) in btrfs_extend_item() argument
4693 leaf = path->nodes[0]; in btrfs_extend_item()
4702 slot = path->slots[0]; in btrfs_extend_item()
4749 void setup_items_for_insert(struct btrfs_root *root, struct btrfs_path *path, in setup_items_for_insert() argument
4763 if (path->slots[0] == 0) { in setup_items_for_insert()
4765 fixup_low_keys(path, &disk_key, 1); in setup_items_for_insert()
4767 btrfs_unlock_up_safe(path, 1); in setup_items_for_insert()
4769 leaf = path->nodes[0]; in setup_items_for_insert()
4770 slot = path->slots[0]; in setup_items_for_insert()
4842 struct btrfs_path *path, in btrfs_insert_empty_items() argument
4856 ret = btrfs_search_slot(trans, root, cpu_key, path, total_size, 1); in btrfs_insert_empty_items()
4862 slot = path->slots[0]; in btrfs_insert_empty_items()
4865 setup_items_for_insert(root, path, cpu_key, data_size, in btrfs_insert_empty_items()
4879 struct btrfs_path *path; in btrfs_insert_item() local
4883 path = btrfs_alloc_path(); in btrfs_insert_item()
4884 if (!path) in btrfs_insert_item()
4886 ret = btrfs_insert_empty_item(trans, root, path, cpu_key, data_size); in btrfs_insert_item()
4888 leaf = path->nodes[0]; in btrfs_insert_item()
4889 ptr = btrfs_item_ptr_offset(leaf, path->slots[0]); in btrfs_insert_item()
4893 btrfs_free_path(path); in btrfs_insert_item()
4903 static void del_ptr(struct btrfs_root *root, struct btrfs_path *path, in del_ptr() argument
4906 struct extent_buffer *parent = path->nodes[level]; in del_ptr()
4938 fixup_low_keys(path, &disk_key, level + 1); in del_ptr()
4955 struct btrfs_path *path, in btrfs_del_leaf() argument
4959 del_ptr(root, path, 1, path->slots[1]); in btrfs_del_leaf()
4965 btrfs_unlock_up_safe(path, 0); in btrfs_del_leaf()
4978 struct btrfs_path *path, int slot, int nr) in btrfs_del_items() argument
4990 leaf = path->nodes[0]; in btrfs_del_items()
5030 btrfs_set_path_blocking(path); in btrfs_del_items()
5032 btrfs_del_leaf(trans, root, path, leaf); in btrfs_del_items()
5040 fixup_low_keys(path, &disk_key, 1); in btrfs_del_items()
5049 slot = path->slots[1]; in btrfs_del_items()
5052 btrfs_set_path_blocking(path); in btrfs_del_items()
5053 wret = push_leaf_left(trans, root, path, 1, 1, in btrfs_del_items()
5058 if (path->nodes[0] == leaf && in btrfs_del_items()
5060 wret = push_leaf_right(trans, root, path, 1, in btrfs_del_items()
5067 path->slots[1] = slot; in btrfs_del_items()
5068 btrfs_del_leaf(trans, root, path, leaf); in btrfs_del_items()
5077 if (path->nodes[0] == leaf) in btrfs_del_items()
5096 int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path) in btrfs_prev_leaf() argument
5102 btrfs_item_key_to_cpu(path->nodes[0], &key, 0); in btrfs_prev_leaf()
5117 btrfs_release_path(path); in btrfs_prev_leaf()
5118 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_prev_leaf()
5121 btrfs_item_key(path->nodes[0], &found_key, 0); in btrfs_prev_leaf()
5158 struct btrfs_path *path, in btrfs_search_forward() argument
5168 int keep_locks = path->keep_locks; in btrfs_search_forward()
5170 path->keep_locks = 1; in btrfs_search_forward()
5174 WARN_ON(path->nodes[level]); in btrfs_search_forward()
5175 path->nodes[level] = cur; in btrfs_search_forward()
5176 path->locks[level] = BTRFS_READ_LOCK; in btrfs_search_forward()
5192 if (level == path->lowest_level) { in btrfs_search_forward()
5196 path->slots[level] = slot; in btrfs_search_forward()
5222 path->slots[level] = slot; in btrfs_search_forward()
5223 btrfs_set_path_blocking(path); in btrfs_search_forward()
5224 sret = btrfs_find_next_key(root, path, min_key, level, in btrfs_search_forward()
5227 btrfs_release_path(path); in btrfs_search_forward()
5235 path->slots[level] = slot; in btrfs_search_forward()
5236 if (level == path->lowest_level) { in btrfs_search_forward()
5240 btrfs_set_path_blocking(path); in btrfs_search_forward()
5249 path->locks[level - 1] = BTRFS_READ_LOCK; in btrfs_search_forward()
5250 path->nodes[level - 1] = cur; in btrfs_search_forward()
5251 unlock_up(path, level, 1, 0, NULL); in btrfs_search_forward()
5254 path->keep_locks = keep_locks; in btrfs_search_forward()
5256 btrfs_unlock_up_safe(path, path->lowest_level + 1); in btrfs_search_forward()
5257 btrfs_set_path_blocking(path); in btrfs_search_forward()
5274 int btrfs_find_next_key(struct btrfs_root *root, struct btrfs_path *path, in btrfs_find_next_key() argument
5280 WARN_ON(!path->keep_locks && !path->skip_locking); in btrfs_find_next_key()
5282 if (!path->nodes[level]) in btrfs_find_next_key()
5285 slot = path->slots[level] + 1; in btrfs_find_next_key()
5286 c = path->nodes[level]; in btrfs_find_next_key()
5293 !path->nodes[level + 1]) in btrfs_find_next_key()
5296 if (path->locks[level + 1] || path->skip_locking) { in btrfs_find_next_key()
5307 orig_lowest = path->lowest_level; in btrfs_find_next_key()
5308 btrfs_release_path(path); in btrfs_find_next_key()
5309 path->lowest_level = level; in btrfs_find_next_key()
5310 ret = btrfs_search_slot(NULL, root, &cur_key, path, in btrfs_find_next_key()
5312 path->lowest_level = orig_lowest; in btrfs_find_next_key()
5316 c = path->nodes[level]; in btrfs_find_next_key()
5317 slot = path->slots[level]; in btrfs_find_next_key()
5344 int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path) in btrfs_next_leaf() argument
5346 return btrfs_next_old_leaf(root, path, 0); in btrfs_next_leaf()
5349 int btrfs_next_old_leaf(struct btrfs_root *root, struct btrfs_path *path, in btrfs_next_old_leaf() argument
5359 int old_spinning = path->leave_spinning; in btrfs_next_old_leaf()
5362 nritems = btrfs_header_nritems(path->nodes[0]); in btrfs_next_old_leaf()
5366 btrfs_item_key_to_cpu(path->nodes[0], &key, nritems - 1); in btrfs_next_old_leaf()
5371 btrfs_release_path(path); in btrfs_next_old_leaf()
5373 path->keep_locks = 1; in btrfs_next_old_leaf()
5374 path->leave_spinning = 1; in btrfs_next_old_leaf()
5377 ret = btrfs_search_old_slot(root, &key, path, time_seq); in btrfs_next_old_leaf()
5379 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); in btrfs_next_old_leaf()
5380 path->keep_locks = 0; in btrfs_next_old_leaf()
5385 nritems = btrfs_header_nritems(path->nodes[0]); in btrfs_next_old_leaf()
5392 if (nritems > 0 && path->slots[0] < nritems - 1) { in btrfs_next_old_leaf()
5394 path->slots[0]++; in btrfs_next_old_leaf()
5412 if (nritems > 0 && ret > 0 && path->slots[0] == nritems - 1) { in btrfs_next_old_leaf()
5418 if (!path->nodes[level]) { in btrfs_next_old_leaf()
5423 slot = path->slots[level] + 1; in btrfs_next_old_leaf()
5424 c = path->nodes[level]; in btrfs_next_old_leaf()
5440 next_rw_lock = path->locks[level]; in btrfs_next_old_leaf()
5441 ret = read_block_for_search(root, path, &next, level, in btrfs_next_old_leaf()
5447 btrfs_release_path(path); in btrfs_next_old_leaf()
5451 if (!path->skip_locking) { in btrfs_next_old_leaf()
5462 btrfs_release_path(path); in btrfs_next_old_leaf()
5467 btrfs_set_path_blocking(path); in btrfs_next_old_leaf()
5474 path->slots[level] = slot; in btrfs_next_old_leaf()
5477 c = path->nodes[level]; in btrfs_next_old_leaf()
5478 if (path->locks[level]) in btrfs_next_old_leaf()
5479 btrfs_tree_unlock_rw(c, path->locks[level]); in btrfs_next_old_leaf()
5482 path->nodes[level] = next; in btrfs_next_old_leaf()
5483 path->slots[level] = 0; in btrfs_next_old_leaf()
5484 if (!path->skip_locking) in btrfs_next_old_leaf()
5485 path->locks[level] = next_rw_lock; in btrfs_next_old_leaf()
5489 ret = read_block_for_search(root, path, &next, level, in btrfs_next_old_leaf()
5495 btrfs_release_path(path); in btrfs_next_old_leaf()
5499 if (!path->skip_locking) { in btrfs_next_old_leaf()
5502 btrfs_set_path_blocking(path); in btrfs_next_old_leaf()
5510 unlock_up(path, 0, 1, 0, NULL); in btrfs_next_old_leaf()
5511 path->leave_spinning = old_spinning; in btrfs_next_old_leaf()
5513 btrfs_set_path_blocking(path); in btrfs_next_old_leaf()
5525 struct btrfs_path *path, u64 min_objectid, in btrfs_previous_item() argument
5534 if (path->slots[0] == 0) { in btrfs_previous_item()
5535 btrfs_set_path_blocking(path); in btrfs_previous_item()
5536 ret = btrfs_prev_leaf(root, path); in btrfs_previous_item()
5540 path->slots[0]--; in btrfs_previous_item()
5542 leaf = path->nodes[0]; in btrfs_previous_item()
5546 if (path->slots[0] == nritems) in btrfs_previous_item()
5547 path->slots[0]--; in btrfs_previous_item()
5549 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_previous_item()
5568 struct btrfs_path *path, u64 min_objectid) in btrfs_previous_extent_item() argument
5576 if (path->slots[0] == 0) { in btrfs_previous_extent_item()
5577 btrfs_set_path_blocking(path); in btrfs_previous_extent_item()
5578 ret = btrfs_prev_leaf(root, path); in btrfs_previous_extent_item()
5582 path->slots[0]--; in btrfs_previous_extent_item()
5584 leaf = path->nodes[0]; in btrfs_previous_extent_item()
5588 if (path->slots[0] == nritems) in btrfs_previous_extent_item()
5589 path->slots[0]--; in btrfs_previous_extent_item()
5591 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_previous_extent_item()