Lines Matching defs:root
16 * Read a root item from the tree. In case we detect a root item smaller then
17 * sizeof(root_item), we know it's an old version of the root structure and
19 * generation numbers as then we know the root was once mounted with an older
20 * kernel that was not aware of the root item structure change.
37 "mismatching generation and generation_v2 found in root item. This root was probably mounted with an older kernel. Resetting all new fields.");
51 * btrfs_find_root - lookup the root by the key.
52 * root: the root of the root tree
55 * root_item: the root item of the tree we look for
56 * root_key: the root key of the tree we look for
59 * of the search key, just lookup the root with the highest offset for a
64 int btrfs_find_root(struct btrfs_root *root, const struct btrfs_key *search_key,
73 ret = btrfs_search_slot(NULL, root, search_key, path, 0, 0);
119 *root, struct btrfs_key *key, struct btrfs_root_item
122 struct btrfs_fs_info *fs_info = root->fs_info;
134 ret = btrfs_search_slot(trans, root, key, path, 0, 1);
140 "unable to find root key (%llu %u %llu) in tree %llu",
142 root->root_key.objectid);
154 * If this is the first time we update the root item which originated
160 ret = btrfs_search_slot(trans, root, key, path,
167 ret = btrfs_del_item(trans, root, path);
173 ret = btrfs_insert_empty_item(trans, root, path,
185 * Update generation_v2 so at the next mount we know the new root
197 int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root *root,
204 return btrfs_insert_item(trans, root, key, item, sizeof(*item));
213 struct btrfs_root *root;
254 root = btrfs_get_fs_root(fs_info, root_objectid, false);
255 err = PTR_ERR_OR_ZERO(root);
275 "Failed to delete root orphan item");
281 WARN_ON(!test_bit(BTRFS_ROOT_ORPHAN_ITEM_INSERTED, &root->state));
282 if (btrfs_root_refs(&root->root_item) == 0) {
283 set_bit(BTRFS_ROOT_DEAD_TREE, &root->state);
284 btrfs_add_dead_root(root);
286 btrfs_put_root(root);
293 /* drop the root item for 'key' from the tree root */
297 struct btrfs_root *root = trans->fs_info->tree_root;
304 ret = btrfs_search_slot(trans, root, key, path, -1, 1);
310 ret = btrfs_del_item(trans, root, path);
381 * that is referencing the root.
384 * the root and ref_id is the id of the subvol or snapshot.
459 struct btrfs_root *root)
461 struct btrfs_root_item *item = &root->root_item;
465 spin_lock(&root->root_item_lock);
469 spin_unlock(&root->root_item_lock);
474 * root: the root of the parent directory
482 * and root tree, the number of items that the qgroup reserves is
486 int btrfs_subvolume_reserve_metadata(struct btrfs_root *root,
493 struct btrfs_fs_info *fs_info = root->fs_info;
499 ret = btrfs_qgroup_reserve_meta_prealloc(root,
508 ret = btrfs_block_rsv_add(root, rsv, num_bytes,
515 btrfs_qgroup_free_meta_prealloc(root, qgroup_num_bytes);
525 void btrfs_subvolume_release_metadata(struct btrfs_root *root,
528 struct btrfs_fs_info *fs_info = root->fs_info;
532 btrfs_qgroup_convert_reserved_meta(root, qgroup_to_release);