Lines Matching full:root

17 #include "root-tree.h"
21 * Read a root item from the tree. In case we detect a root item smaller then
22 * sizeof(root_item), we know it's an old version of the root structure and
24 * generation numbers as then we know the root was once mounted with an older
25 * kernel that was not aware of the root item structure change.
42 …"mismatching generation and generation_v2 found in root item. This root was probably mounted with … in btrfs_read_root_item()
54 * Lookup the root by the key.
56 * root: the root of the root tree
59 * root_item: the root item of the tree we look for
60 * root_key: the root key of the tree we look for
63 * of the search key, just lookup the root with the highest offset for a
68 int btrfs_find_root(struct btrfs_root *root, const struct btrfs_key *search_key, in btrfs_find_root() argument
77 ret = btrfs_search_slot(NULL, root, search_key, path, 0, 0); in btrfs_find_root()
123 *root, struct btrfs_key *key, struct btrfs_root_item in btrfs_update_root()
126 struct btrfs_fs_info *fs_info = root->fs_info; in btrfs_update_root()
138 ret = btrfs_search_slot(trans, root, key, path, 0, 1); in btrfs_update_root()
144 "unable to find root key (%llu %u %llu) in tree %llu", in btrfs_update_root()
146 root->root_key.objectid); in btrfs_update_root()
158 * If this is the first time we update the root item which originated in btrfs_update_root()
164 ret = btrfs_search_slot(trans, root, key, path, in btrfs_update_root()
171 ret = btrfs_del_item(trans, root, path); in btrfs_update_root()
177 ret = btrfs_insert_empty_item(trans, root, path, in btrfs_update_root()
189 * Update generation_v2 so at the next mount we know the new root in btrfs_update_root()
201 int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root *root, in btrfs_insert_root() argument
208 return btrfs_insert_item(trans, root, key, item, sizeof(*item)); in btrfs_insert_root()
217 struct btrfs_root *root; in btrfs_find_orphan_roots() local
258 root = btrfs_get_fs_root(fs_info, root_objectid, false); in btrfs_find_orphan_roots()
259 err = PTR_ERR_OR_ZERO(root); in btrfs_find_orphan_roots()
279 "Failed to delete root orphan item"); in btrfs_find_orphan_roots()
285 WARN_ON(!test_bit(BTRFS_ROOT_ORPHAN_ITEM_INSERTED, &root->state)); in btrfs_find_orphan_roots()
286 if (btrfs_root_refs(&root->root_item) == 0) { in btrfs_find_orphan_roots()
289 btrfs_disk_key_to_cpu(&drop_key, &root->root_item.drop_progress); in btrfs_find_orphan_roots()
299 set_bit(BTRFS_ROOT_UNFINISHED_DROP, &root->state); in btrfs_find_orphan_roots()
302 set_bit(BTRFS_ROOT_DEAD_TREE, &root->state); in btrfs_find_orphan_roots()
303 btrfs_add_dead_root(root); in btrfs_find_orphan_roots()
305 btrfs_put_root(root); in btrfs_find_orphan_roots()
312 /* drop the root item for 'key' from the tree root */
316 struct btrfs_root *root = trans->fs_info->tree_root; in btrfs_del_root() local
323 ret = btrfs_search_slot(trans, root, key, path, -1, 1); in btrfs_del_root()
329 ret = btrfs_del_item(trans, root, path); in btrfs_del_root()
397 * that is referencing the root.
400 * the root and ref_id is the id of the subvol or snapshot.
475 struct btrfs_root *root) in btrfs_update_root_times() argument
477 struct btrfs_root_item *item = &root->root_item; in btrfs_update_root_times()
481 spin_lock(&root->root_item_lock); in btrfs_update_root_times()
485 spin_unlock(&root->root_item_lock); in btrfs_update_root_times()
491 * root: the root of the parent directory
499 * and root tree, the number of items that the qgroup reserves is
503 int btrfs_subvolume_reserve_metadata(struct btrfs_root *root, in btrfs_subvolume_reserve_metadata() argument
510 struct btrfs_fs_info *fs_info = root->fs_info; in btrfs_subvolume_reserve_metadata()
516 ret = btrfs_qgroup_reserve_meta_prealloc(root, in btrfs_subvolume_reserve_metadata()
533 btrfs_qgroup_free_meta_prealloc(root, qgroup_num_bytes); in btrfs_subvolume_reserve_metadata()
543 void btrfs_subvolume_release_metadata(struct btrfs_root *root, in btrfs_subvolume_release_metadata() argument
546 struct btrfs_fs_info *fs_info = root->fs_info; in btrfs_subvolume_release_metadata()
550 btrfs_qgroup_convert_reserved_meta(root, qgroup_to_release); in btrfs_subvolume_release_metadata()