Lines Matching defs:key

53  * Lookup the root by the key.
56 * search_key: the key to search
59 * root_key: the root key of the tree we look for
62 * of the search key, just lookup the root with the highest offset for a
80 if (search_key->offset != -1ULL) { /* the search key is exact */
129 *root, struct btrfs_key *key, struct btrfs_root_item
144 ret = btrfs_search_slot(trans, root, key, path, 0, 1);
150 "unable to find root key (%llu %u %llu) in tree %llu",
151 key->objectid, key->type, key->offset, btrfs_root_id(root));
169 ret = btrfs_search_slot(trans, root, key, path,
183 key, sizeof(*item));
207 const struct btrfs_key *key, struct btrfs_root_item *item)
213 return btrfs_insert_item(trans, root, key, item, sizeof(*item));
221 struct btrfs_key key;
230 key.objectid = BTRFS_ORPHAN_OBJECTID;
231 key.type = BTRFS_ORPHAN_ITEM_KEY;
232 key.offset = 0;
237 ret = btrfs_search_slot(NULL, tree_root, &key, path, 0, 0);
253 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
256 if (key.objectid != BTRFS_ORPHAN_OBJECTID ||
257 key.type != BTRFS_ORPHAN_ITEM_KEY)
260 root_objectid = key.offset;
261 key.offset++;
317 /* drop the root item for 'key' from the tree root */
319 const struct btrfs_key *key)
328 ret = btrfs_search_slot(trans, root, key, path, -1, 1);
332 /* The root must exist but we did not find it by the key. */
351 struct btrfs_key key;
359 key.objectid = root_id;
360 key.type = BTRFS_ROOT_BACKREF_KEY;
361 key.offset = ref_id;
363 ret = btrfs_search_slot(trans, tree_root, &key, path, -1, 1);
387 if (key.type == BTRFS_ROOT_BACKREF_KEY) {
389 key.objectid = ref_id;
390 key.type = BTRFS_ROOT_REF_KEY;
391 key.offset = root_id;
420 struct btrfs_key key;
431 key.objectid = root_id;
432 key.type = BTRFS_ROOT_BACKREF_KEY;
433 key.offset = ref_id;
435 ret = btrfs_insert_empty_item(trans, tree_root, path, &key,
452 if (key.type == BTRFS_ROOT_BACKREF_KEY) {
454 key.objectid = ref_id;
455 key.type = BTRFS_ROOT_REF_KEY;
456 key.offset = root_id;