Lines Matching defs:key
264 struct btrfs_disk_key key;
356 * key order of the log:
445 btrfs_node_key(eb, &tm->key, slot);
1214 btrfs_set_node_key(eb, &tm->key, tm->slot);
1222 btrfs_set_node_key(eb, &tm->key, tm->slot);
1596 * disk order is close to key order
1712 * search for key in the extent_buffer. The items start at offset p,
1716 * the place where you would insert key if it is not found in
1719 * slot may point to max if the key is bigger than all of the keys
1723 const struct btrfs_key *key,
1760 ret = comp_keys(tmp, key);
1779 int btrfs_bin_search(struct extent_buffer *eb, const struct btrfs_key *key,
1786 key, btrfs_header_nritems(eb),
1792 key, btrfs_header_nritems(eb),
2027 /* update the parent key to reflect our changes */
2330 * operations on the tree might require changing key pointers higher up in the
2394 const struct btrfs_key *key)
2457 reada_for_search(fs_info, p, level, slot, key->objectid);
2556 struct btrfs_key key;
2562 key.type = key_type;
2563 key.objectid = iobjectid;
2564 key.offset = ioff;
2566 ret = btrfs_search_slot(NULL, fs_root, &key, path, 0, 0);
2579 if (found_key->type != key.type ||
2580 found_key->objectid != key.objectid)
2683 * btrfs_search_slot - look for a key in a tree and perform necessary
2689 * @key: The key we are looking for
2698 * If @key is found, 0 is returned and you can find the item in the leaf level
2701 * If @key isn't found, 1 is returned and the leaf level of the path (level 0)
2708 const struct btrfs_key *key, struct btrfs_path *p,
2835 * we can safely assume the target key will always be in slot 0
2838 * lowest key in the child node, thus we can skip searching
2845 ret = btrfs_bin_search(b, key, &slot);
2862 err = split_leaf(trans, root, key,
2893 * Slot 0 is special, if we change the key we have to update
2912 err = read_block_for_search(root, p, &b, level, slot, key);
2953 * Like btrfs_search_slot, this looks for a key in the given tree. It uses the
2955 * modification log to search for the key in a previous version of this tree, as
2963 int btrfs_search_old_slot(struct btrfs_root *root, const struct btrfs_key *key,
2980 return btrfs_search_slot(NULL, root, key, p, 0, 0);
3006 ret = btrfs_bin_search(b, key, &slot);
3029 err = read_block_for_search(root, p, &b, level, slot, key);
3073 const struct btrfs_key *key,
3081 ret = btrfs_search_slot(NULL, root, key, p, 0, 0);
3139 * making sure the right key of each node is points to 'key'.
3146 struct btrfs_disk_key *key, int level)
3161 btrfs_set_node_key(t, key, tslot);
3169 * update item key.
3172 * that the new key won't break the order
3188 "slot %u key (%llu %u %llu) new key (%llu %u %llu)",
3202 "slot %u key (%llu %u %llu) new key (%llu %u %llu)",
3221 * Check key order of two sibling extent buffers.
3234 * key in leaf @right is 7.
3236 * And since tree checker has ensured all key order in each tree block
3237 * is correct, we only need to bother the last key of @left and the first
3238 * key of @right.
3249 /* No key to check in one of the tree blocks */
3263 "bad key order, sibling blocks, left last (%llu %u %llu) right first (%llu %u %llu)",
3334 * Don't call tree_mod_log_insert_move here, key removal was
3489 * slot and level indicate where you want the key to go, and
3490 * blocknr is the block the key points to.
3494 struct btrfs_disk_key *key, u64 bytenr,
3523 btrfs_set_node_key(lower, key, slot);
4441 struct btrfs_key key;
4449 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
4451 BUG_ON(key.type != BTRFS_EXTENT_DATA_KEY &&
4452 key.type != BTRFS_EXTENT_CSUM_KEY);
4458 if (key.type == BTRFS_EXTENT_DATA_KEY) {
4467 ret = btrfs_search_slot(trans, root, &key, path, 0, 1);
4484 if (key.type == BTRFS_EXTENT_DATA_KEY) {
4492 ret = split_leaf(trans, root, &key, path, ins_len, 1);
4907 * Given a key and some data, insert items into the tree.
4940 * Given a key and some data, insert an item into the tree.
5166 struct btrfs_key key;
5171 btrfs_item_key_to_cpu(path->nodes[0], &key, 0);
5172 orig_key = key;
5174 if (key.offset > 0) {
5175 key.offset--;
5176 } else if (key.type > 0) {
5177 key.type--;
5178 key.offset = (u64)-1;
5179 } else if (key.objectid > 0) {
5180 key.objectid--;
5181 key.type = (u8)-1;
5182 key.offset = (u64)-1;
5188 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
5193 * Previous key not found. Even if we were at slot 0 of the leaf we had
5195 * be in a slot pointing to the same original key - this can happen if
5200 * so that the caller does not process the same key again, which may or
5212 * At slot 0, same key as before, it means orig_key is
5213 * the lowest, leftmost, key in the tree. We're done.
5220 ret = comp_keys(&found_key, &key);
5222 * We might have had an item with the previous key in the tree right
5226 * previous key can exist as the only element of a leaf (big fat item).
5228 * btrfs_previous_item) don't miss an existing item with a key matching
5229 * the previous key we computed above.
5241 * This does not cow, but it does stuff the starting key it finds back
5243 * key and get a writable path.
5316 * we didn't find a candidate key in this node, walk forward
5331 /* save our key for returning back */
5363 * and fixup the path. It looks for and returns the next key in the
5366 * 0 is returned if another key is found, < 0 if there are any errors
5373 struct btrfs_key *key, int level, u64 min_trans)
5422 btrfs_item_key_to_cpu(c, key, slot);
5430 btrfs_node_key_to_cpu(c, key, slot);
5454 struct btrfs_key key;
5464 btrfs_item_key_to_cpu(path->nodes[0], &key, nritems - 1);
5475 ret = btrfs_search_old_slot(root, &key, path, time_seq);
5477 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
5486 * could have added more items next to the key that used to be
5500 * gets another one with bigger key.offset to replace it.
5506 * with ret > 0, the key isn't found, the path points to the slot
5540 slot, &key);
5590 0, &key);