Lines Matching defs:key
810 * disk order is close to key order
907 * Search for a key in the given extent_buffer.
913 * The slot in the extent buffer is returned via @slot. If the key exists in the
914 * extent buffer, then @slot will point to the slot where the key is, otherwise
915 * it points to the slot where you would insert the key.
918 * key) if the key is bigger than the last key in the extent buffer.
921 const struct btrfs_key *key, int *slot)
972 ret = comp_keys(tmp, key);
1248 /* update the parent key to reflect our changes */
1556 * operations on the tree might require changing key pointers higher up in the
1622 const struct btrfs_key *key)
1653 reada_for_search(fs_info, p, level, slot, key->objectid);
1708 reada_for_search(fs_info, p, level, slot, key->objectid);
1795 struct btrfs_key key;
1801 key.type = key_type;
1802 key.objectid = iobjectid;
1803 key.offset = ioff;
1805 ret = btrfs_search_slot(NULL, fs_root, &key, path, 0, 0);
1818 if (found_key->type != key.type ||
1819 found_key->objectid != key.objectid)
1946 const struct btrfs_key *key,
1952 * exact match (prev_cmp == 0), we can safely assume the target key will
1953 * always be at slot 0 on lower levels, since each key pointer
1954 * (struct btrfs_key_ptr) refers to the lowest key accessible from the
1962 return btrfs_bin_search(eb, search_low_slot, key, slot);
1967 const struct btrfs_key *key,
1980 * destination slot for the key is not slot 0, then we can unlock our
2003 * Doing the extra comparison with the first key is cheap,
2004 * taking into account that the first key is very likely
2009 ret = comp_keys(&first_key, key);
2012 * The first key is smaller than the key we want
2020 * case the key does not end up at slot 0 of the
2027 * The first key is >= then the key we want to
2029 * the target key will be at slot 0.
2031 * We can not unlock upper nodes when the key is
2032 * less than the first key, because we will need
2033 * to update the key at slot 0 of the parent node
2035 * If the key matches the first key, then we can
2054 ret = search_for_key_slot(leaf, search_low_slot, key,
2062 * Item key already exists. In this case, if we are allowed to
2063 * insert the item (for example, in dir_item case, item key
2080 err = split_leaf(trans, root, key, path, ins_len,
2094 * btrfs_search_slot - look for a key in a tree and perform necessary
2100 * @key: The key we are looking for
2115 * If @key is found, 0 is returned and you can find the item in the leaf level
2118 * If @key isn't found, 1 is returned and the leaf level of the path (level 0)
2125 const struct btrfs_key *key, struct btrfs_path *p,
2267 ret = search_leaf(trans, root, key, p, ins_len, prev_cmp);
2274 ret = search_for_key_slot(b, 0, key, prev_cmp, &slot);
2296 * Slot 0 is special, if we change the key we have to update
2315 err = read_block_for_search(root, p, &b, level, slot, key);
2365 * Like btrfs_search_slot, this looks for a key in the given tree. It uses the
2367 * modification log to search for the key in a previous version of this tree, as
2375 int btrfs_search_old_slot(struct btrfs_root *root, const struct btrfs_key *key,
2393 return btrfs_search_slot(NULL, root, key, p, 0, 0);
2419 ret = btrfs_bin_search(b, 0, key, &slot);
2442 err = read_block_for_search(root, p, &b, level, slot, key);
2479 struct btrfs_key key;
2484 btrfs_item_key_to_cpu(path->nodes[0], &key, 0);
2485 orig_key = key;
2487 if (key.offset > 0) {
2488 key.offset--;
2489 } else if (key.type > 0) {
2490 key.type--;
2491 key.offset = (u64)-1;
2492 } else if (key.objectid > 0) {
2493 key.objectid--;
2494 key.type = (u8)-1;
2495 key.offset = (u64)-1;
2501 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
2506 * Previous key not found. Even if we were at slot 0 of the leaf we had
2508 * be in a slot pointing to the same original key - this can happen if
2513 * so that the caller does not process the same key again, which may or
2525 * At slot 0, same key as before, it means orig_key is
2526 * the lowest, leftmost, key in the tree. We're done.
2533 ret = comp_keys(&found_key, &key);
2535 * We might have had an item with the previous key in the tree right
2539 * previous key can exist as the only element of a leaf (big fat item).
2541 * btrfs_previous_item) don't miss an existing item with a key matching
2542 * the previous key we computed above.
2562 const struct btrfs_key *key,
2570 ret = btrfs_search_slot(NULL, root, key, p, 0, 0);
2632 int btrfs_search_backwards(struct btrfs_root *root, struct btrfs_key *key,
2637 ret = btrfs_search_slot(NULL, root, key, path, 0, 0);
2639 ret = btrfs_previous_item(root, path, key->objectid, key->type);
2642 btrfs_item_key_to_cpu(path->nodes[0], key, path->slots[0]);
2651 * @key: Will contain a valid item if found.
2658 int btrfs_get_next_valid_item(struct btrfs_root *root, struct btrfs_key *key,
2669 btrfs_item_key_to_cpu(path->nodes[0], key, path->slots[0]);
2675 * making sure the right key of each node is points to 'key'.
2683 struct btrfs_disk_key *key, int level)
2698 btrfs_set_node_key(t, key, tslot);
2706 * update item key.
2709 * that the new key won't break the order
2727 "slot %u key (%llu %u %llu) new key (%llu %u %llu)",
2741 "slot %u key (%llu %u %llu) new key (%llu %u %llu)",
2759 * Check key order of two sibling extent buffers.
2772 * key in leaf @right is 7.
2774 * And since tree checker has ensured all key order in each tree block
2775 * is correct, we only need to bother the last key of @left and the first
2776 * key of @right.
2787 /* No key to check in one of the tree blocks */
2805 "bad key order, sibling blocks, left last (%llu %u %llu) right first (%llu %u %llu)",
3039 * slot and level indicate where you want the key to go, and
3040 * blocknr is the block the key points to.
3044 struct btrfs_disk_key *key, u64 bytenr,
3079 btrfs_set_node_key(lower, key, slot);
3967 struct btrfs_key key;
3975 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
3977 BUG_ON(key.type != BTRFS_EXTENT_DATA_KEY &&
3978 key.type != BTRFS_EXTENT_CSUM_KEY);
3984 if (key.type == BTRFS_EXTENT_DATA_KEY) {
3993 ret = btrfs_search_slot(trans, root, &key, path, 0, 1);
4010 if (key.type == BTRFS_EXTENT_DATA_KEY) {
4017 ret = split_leaf(trans, root, &key, path, ins_len, 1);
4389 * @key: The key of the new item.
4390 * @data_size: The size of the data associated with the new key.
4395 const struct btrfs_key *key,
4400 batch.keys = key;
4409 * Given a key and some data, insert items into the tree.
4436 * Given a key and some data, insert an item into the tree.
4724 * This does not cow, but it does stuff the starting key it finds back
4726 * key and get a writable path.
4800 * we didn't find a candidate key in this node, walk forward
4814 /* save our key for returning back */
4844 * and fixup the path. It looks for and returns the next key in the
4847 * 0 is returned if another key is found, < 0 if there are any errors
4854 struct btrfs_key *key, int level, u64 min_trans)
4903 btrfs_item_key_to_cpu(c, key, slot);
4911 btrfs_node_key_to_cpu(c, key, slot);
4926 struct btrfs_key key;
4943 btrfs_item_key_to_cpu(path->nodes[0], &key, nritems - 1);
4952 ret = btrfs_search_old_slot(root, &key, path, time_seq);
4966 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
4976 * could have added more items next to the key that used to be
4990 * gets another one with bigger key.offset to replace it.
4996 * with ret > 0, the key isn't found, the path points to the slot
5039 slot, &key);
5083 0, &key);