Lines Matching refs:slot
30 int level, int slot);
258 int slot; member
434 alloc_tree_mod_elem(struct extent_buffer *eb, int slot, in alloc_tree_mod_elem() argument
445 btrfs_node_key(eb, &tm->key, slot); in alloc_tree_mod_elem()
446 tm->blockptr = btrfs_node_blockptr(eb, slot); in alloc_tree_mod_elem()
449 tm->slot = slot; in alloc_tree_mod_elem()
450 tm->generation = btrfs_node_ptr_generation(eb, slot); in alloc_tree_mod_elem()
456 static noinline int tree_mod_log_insert_key(struct extent_buffer *eb, int slot, in tree_mod_log_insert_key() argument
465 tm = alloc_tree_mod_elem(eb, slot, op, flags); in tree_mod_log_insert_key()
505 tm->slot = src_slot; in tree_mod_log_insert_move()
1210 BUG_ON(tm->slot < n); in __tree_mod_log_rewind()
1214 btrfs_set_node_key(eb, &tm->key, tm->slot); in __tree_mod_log_rewind()
1215 btrfs_set_node_blockptr(eb, tm->slot, tm->blockptr); in __tree_mod_log_rewind()
1216 btrfs_set_node_ptr_generation(eb, tm->slot, in __tree_mod_log_rewind()
1221 BUG_ON(tm->slot >= n); in __tree_mod_log_rewind()
1222 btrfs_set_node_key(eb, &tm->key, tm->slot); in __tree_mod_log_rewind()
1223 btrfs_set_node_blockptr(eb, tm->slot, tm->blockptr); in __tree_mod_log_rewind()
1224 btrfs_set_node_ptr_generation(eb, tm->slot, in __tree_mod_log_rewind()
1232 o_dst = btrfs_node_key_ptr_offset(tm->slot); in __tree_mod_log_rewind()
1288 BUG_ON(tm->slot != 0); in tree_mod_log_rewind()
1724 int max, int *slot) in generic_bin_search() argument
1767 *slot = mid; in generic_bin_search()
1771 *slot = low; in generic_bin_search()
1780 int *slot) in btrfs_bin_search() argument
1787 slot); in btrfs_bin_search()
1793 slot); in btrfs_bin_search()
1816 int slot) in btrfs_read_node_slot() argument
1822 if (slot < 0 || slot >= btrfs_header_nritems(parent)) in btrfs_read_node_slot()
1827 btrfs_node_key_to_cpu(parent, &first_key, slot); in btrfs_read_node_slot()
1828 eb = read_tree_block(parent->fs_info, btrfs_node_blockptr(parent, slot), in btrfs_read_node_slot()
1829 btrfs_node_ptr_generation(parent, slot), in btrfs_read_node_slot()
2219 int level, int slot, u64 objectid) in reada_for_search() argument
2240 search = btrfs_node_blockptr(node, slot); in reada_for_search()
2251 nr = slot; in reada_for_search()
2283 int slot; in reada_for_balance() local
2296 slot = path->slots[level + 1]; in reada_for_balance()
2298 if (slot > 0) { in reada_for_balance()
2299 block1 = btrfs_node_blockptr(parent, slot - 1); in reada_for_balance()
2300 gen = btrfs_node_ptr_generation(parent, slot - 1); in reada_for_balance()
2311 if (slot + 1 < nritems) { in reada_for_balance()
2312 block2 = btrfs_node_blockptr(parent, slot + 1); in reada_for_balance()
2313 gen = btrfs_node_ptr_generation(parent, slot + 1); in reada_for_balance()
2393 struct extent_buffer **eb_ret, int level, int slot, in read_block_for_search() argument
2404 blocknr = btrfs_node_blockptr(*eb_ret, slot); in read_block_for_search()
2405 gen = btrfs_node_ptr_generation(*eb_ret, slot); in read_block_for_search()
2407 btrfs_node_key_to_cpu(*eb_ret, &first_key, slot); in read_block_for_search()
2457 reada_for_search(fs_info, p, level, slot, key->objectid); in read_block_for_search()
2712 int slot; in btrfs_search_slot() local
2842 slot = 0; in btrfs_search_slot()
2845 ret = btrfs_bin_search(b, key, &slot); in btrfs_search_slot()
2852 p->slots[level] = slot; in btrfs_search_slot()
2876 if (ret && slot > 0) { in btrfs_search_slot()
2878 slot--; in btrfs_search_slot()
2880 p->slots[level] = slot; in btrfs_search_slot()
2890 slot = p->slots[level]; in btrfs_search_slot()
2897 if (slot == 0 && ins_len && write_lock_level < level + 1) { in btrfs_search_slot()
2912 err = read_block_for_search(root, p, &b, level, slot, key); in btrfs_search_slot()
2968 int slot; in btrfs_search_old_slot() local
3006 ret = btrfs_bin_search(b, key, &slot); in btrfs_search_old_slot()
3011 p->slots[level] = slot; in btrfs_search_old_slot()
3016 if (ret && slot > 0) { in btrfs_search_old_slot()
3018 slot--; in btrfs_search_old_slot()
3020 p->slots[level] = slot; in btrfs_search_old_slot()
3029 err = read_block_for_search(root, p, &b, level, slot, key); in btrfs_search_old_slot()
3180 int slot; in btrfs_set_item_key_safe() local
3183 slot = path->slots[0]; in btrfs_set_item_key_safe()
3184 if (slot > 0) { in btrfs_set_item_key_safe()
3185 btrfs_item_key(eb, &disk_key, slot - 1); in btrfs_set_item_key_safe()
3189 slot, btrfs_disk_key_objectid(&disk_key), in btrfs_set_item_key_safe()
3198 if (slot < btrfs_header_nritems(eb) - 1) { in btrfs_set_item_key_safe()
3199 btrfs_item_key(eb, &disk_key, slot + 1); in btrfs_set_item_key_safe()
3203 slot, btrfs_disk_key_objectid(&disk_key), in btrfs_set_item_key_safe()
3214 btrfs_set_item_key(eb, &disk_key, slot); in btrfs_set_item_key_safe()
3216 if (slot == 0) in btrfs_set_item_key_safe()
3495 int slot, int level) in insert_ptr() argument
3505 BUG_ON(slot > nritems); in insert_ptr()
3507 if (slot != nritems) { in insert_ptr()
3509 ret = tree_mod_log_insert_move(lower, slot + 1, slot, in insert_ptr()
3510 nritems - slot); in insert_ptr()
3514 btrfs_node_key_ptr_offset(slot + 1), in insert_ptr()
3515 btrfs_node_key_ptr_offset(slot), in insert_ptr()
3516 (nritems - slot) * sizeof(struct btrfs_key_ptr)); in insert_ptr()
3519 ret = tree_mod_log_insert_key(lower, slot, MOD_LOG_KEY_ADD, in insert_ptr()
3523 btrfs_set_node_key(lower, key, slot); in insert_ptr()
3524 btrfs_set_node_blockptr(lower, slot, bytenr); in insert_ptr()
3526 btrfs_set_node_ptr_generation(lower, slot, trans->transid); in insert_ptr()
3686 int slot; in __push_leaf_right() local
3704 slot = path->slots[1]; in __push_leaf_right()
3789 btrfs_set_node_key(upper, &disk_key, slot + 1); in __push_leaf_right()
3831 int slot; in push_leaf_right() local
3839 slot = path->slots[1]; in push_leaf_right()
3841 if (slot >= btrfs_header_nritems(upper) - 1) in push_leaf_right()
3846 right = btrfs_read_node_slot(upper, slot + 1); in push_leaf_right()
3863 slot + 1, &right, BTRFS_NESTING_RIGHT_COW); in push_leaf_right()
4069 int slot; in push_leaf_left() local
4074 slot = path->slots[1]; in push_leaf_left()
4075 if (slot == 0) 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()
4142 int slot, int mid, int nritems) in copy_for_split() argument
4181 BUG_ON(path->slots[0] != slot); in copy_for_split()
4183 if (mid <= slot) { in copy_for_split()
4214 int slot; in push_for_double_split() local
4218 slot = path->slots[0]; in push_for_double_split()
4219 if (slot < btrfs_header_nritems(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()
4245 slot = path->slots[0]; in push_for_double_split()
4247 if (slot > 0) in push_for_double_split()
4249 ret = push_leaf_left(trans, root, path, 1, space_needed, 0, slot); in push_for_double_split()
4277 int slot; in split_leaf() local
4287 slot = path->slots[0]; in split_leaf()
4288 if (extend && data_size + btrfs_item_size_nr(l, slot) + in split_leaf()
4296 if (slot < btrfs_header_nritems(l)) in split_leaf()
4305 if (slot > 0) in split_leaf()
4327 slot = path->slots[0]; in split_leaf()
4331 if (mid <= slot) { in split_leaf()
4335 if (slot >= nritems) { in split_leaf()
4338 mid = slot; in split_leaf()
4351 if (!extend && data_size && slot == 0) { in split_leaf()
4353 } else if ((extend || !data_size) && slot == 0) { in split_leaf()
4356 mid = slot; in split_leaf()
4391 if (mid <= slot) { in split_leaf()
4419 copy_for_split(trans, path, l, right, slot, mid, nritems); in split_leaf()
4511 int slot; in split_item() local
4534 slot = path->slots[0] + 1; in split_item()
4536 if (slot != nritems) { in split_item()
4538 memmove_extent_buffer(leaf, btrfs_item_nr_offset(slot + 1), in split_item()
4539 btrfs_item_nr_offset(slot), in split_item()
4540 (nritems - slot) * sizeof(struct btrfs_item)); in split_item()
4544 btrfs_set_item_key(leaf, &disk_key, slot); in split_item()
4546 new_item = btrfs_item_nr(slot); in split_item()
4564 btrfs_item_ptr_offset(leaf, slot), in split_item()
4646 int slot; in btrfs_truncate_item() local
4658 slot = path->slots[0]; in btrfs_truncate_item()
4660 old_size = btrfs_item_size_nr(leaf, slot); in btrfs_truncate_item()
4667 old_data_start = btrfs_item_offset_nr(leaf, slot); in btrfs_truncate_item()
4671 BUG_ON(slot < 0); in btrfs_truncate_item()
4672 BUG_ON(slot >= nritems); in btrfs_truncate_item()
4679 for (i = slot; i < nritems; i++) { in btrfs_truncate_item()
4696 btrfs_item_key(leaf, &disk_key, slot); in btrfs_truncate_item()
4702 fi = btrfs_item_ptr(leaf, slot, in btrfs_truncate_item()
4709 ptr = btrfs_item_ptr_offset(leaf, slot); in btrfs_truncate_item()
4722 btrfs_set_item_key(leaf, &disk_key, slot); in btrfs_truncate_item()
4723 if (slot == 0) in btrfs_truncate_item()
4727 item = btrfs_item_nr(slot); in btrfs_truncate_item()
4742 int slot; in btrfs_extend_item() local
4761 slot = path->slots[0]; in btrfs_extend_item()
4762 old_data = btrfs_item_end_nr(leaf, slot); in btrfs_extend_item()
4764 BUG_ON(slot < 0); in btrfs_extend_item()
4765 if (slot >= nritems) { in btrfs_extend_item()
4768 slot, nritems); in btrfs_extend_item()
4777 for (i = slot; i < nritems; i++) { in btrfs_extend_item()
4791 old_size = btrfs_item_size_nr(leaf, slot); in btrfs_extend_item()
4792 item = btrfs_item_nr(slot); in btrfs_extend_item()
4824 int slot; in setup_items_for_insert() local
4840 slot = path->slots[0]; in setup_items_for_insert()
4853 if (slot != nritems) { in setup_items_for_insert()
4854 unsigned int old_data = btrfs_item_end_nr(leaf, slot); in setup_items_for_insert()
4860 slot, old_data, data_end); in setup_items_for_insert()
4867 for (i = slot; i < nritems; i++) { in setup_items_for_insert()
4876 memmove_extent_buffer(leaf, btrfs_item_nr_offset(slot + nr), in setup_items_for_insert()
4877 btrfs_item_nr_offset(slot), in setup_items_for_insert()
4878 (nritems - slot) * sizeof(struct btrfs_item)); in setup_items_for_insert()
4890 btrfs_set_item_key(leaf, &disk_key, slot + i); in setup_items_for_insert()
4891 item = btrfs_item_nr(slot + i); in setup_items_for_insert()
4917 int slot; in btrfs_insert_empty_items() local
4932 slot = path->slots[0]; in btrfs_insert_empty_items()
4933 BUG_ON(slot < 0); in btrfs_insert_empty_items()
4973 int level, int slot) in del_ptr() argument
4980 if (slot != nritems - 1) { in del_ptr()
4982 ret = tree_mod_log_insert_move(parent, slot, slot + 1, in del_ptr()
4983 nritems - slot - 1); in del_ptr()
4987 btrfs_node_key_ptr_offset(slot), in del_ptr()
4988 btrfs_node_key_ptr_offset(slot + 1), in del_ptr()
4990 (nritems - slot - 1)); in del_ptr()
4992 ret = tree_mod_log_insert_key(parent, slot, MOD_LOG_KEY_REMOVE, in del_ptr()
5003 } else if (slot == 0) { in del_ptr()
5047 struct btrfs_path *path, int slot, int nr) in btrfs_del_items() argument
5060 last_off = btrfs_item_offset_nr(leaf, slot + nr - 1); in btrfs_del_items()
5063 dsize += btrfs_item_size_nr(leaf, slot + i); in btrfs_del_items()
5067 if (slot + nr != nritems) { in btrfs_del_items()
5077 for (i = slot + nr; i < nritems; i++) { in btrfs_del_items()
5085 memmove_extent_buffer(leaf, btrfs_item_nr_offset(slot), in btrfs_del_items()
5086 btrfs_item_nr_offset(slot + nr), in btrfs_del_items()
5088 (nritems - slot - nr)); in btrfs_del_items()
5104 if (slot == 0) { in btrfs_del_items()
5117 slot = path->slots[1]; in btrfs_del_items()
5135 path->slots[1] = slot; in btrfs_del_items()
5261 int slot; in btrfs_search_forward() local
5283 sret = btrfs_bin_search(cur, min_key, &slot); in btrfs_search_forward()
5291 if (slot >= nritems) in btrfs_search_forward()
5294 path->slots[level] = slot; in btrfs_search_forward()
5295 btrfs_item_key_to_cpu(cur, &found_key, slot); in btrfs_search_forward()
5298 if (sret && slot > 0) in btrfs_search_forward()
5299 slot--; in btrfs_search_forward()
5304 while (slot < nritems) { in btrfs_search_forward()
5307 gen = btrfs_node_ptr_generation(cur, slot); in btrfs_search_forward()
5309 slot++; in btrfs_search_forward()
5319 if (slot >= nritems) { in btrfs_search_forward()
5320 path->slots[level] = slot; in btrfs_search_forward()
5332 btrfs_node_key_to_cpu(cur, &found_key, slot); in btrfs_search_forward()
5333 path->slots[level] = slot; in btrfs_search_forward()
5339 cur = btrfs_read_node_slot(cur, slot); in btrfs_search_forward()
5375 int slot; in btrfs_find_next_key() local
5383 slot = path->slots[level] + 1; in btrfs_find_next_key()
5386 if (slot >= btrfs_header_nritems(c)) { in btrfs_find_next_key()
5399 slot = btrfs_header_nritems(c) - 1; in btrfs_find_next_key()
5401 btrfs_item_key_to_cpu(c, &cur_key, slot); in btrfs_find_next_key()
5403 btrfs_node_key_to_cpu(c, &cur_key, slot); in btrfs_find_next_key()
5415 slot = path->slots[level]; in btrfs_find_next_key()
5417 slot++; in btrfs_find_next_key()
5422 btrfs_item_key_to_cpu(c, key, slot); in btrfs_find_next_key()
5424 u64 gen = btrfs_node_ptr_generation(c, slot); in btrfs_find_next_key()
5427 slot++; in btrfs_find_next_key()
5430 btrfs_node_key_to_cpu(c, key, slot); in btrfs_find_next_key()
5450 int slot; in btrfs_next_old_leaf() local
5521 slot = path->slots[level] + 1; in btrfs_next_old_leaf()
5523 if (slot >= btrfs_header_nritems(c)) { in btrfs_next_old_leaf()
5540 slot, &key); in btrfs_next_old_leaf()
5574 path->slots[level] = slot; in btrfs_next_old_leaf()