Lines Matching refs:root

116 	struct rb_root_cached root;
120 #define PREFTREE_INIT { .root = RB_ROOT_CACHED, .count = 0 }
221 * Add @newref to the @root rbtree, merging identical refs.
230 struct rb_root_cached *root;
237 root = &preftree->root;
238 p = &root->rb_root.rb_node;
279 rb_insert_color_cached(&newref->rbnode, root, leftmost);
284 * just free everything and then reset the tree root.
291 &preftree->root.rb_root, rbnode) {
296 preftree->root = RB_ROOT_CACHED;
315 * root for resolving | y | y | y | y
328 * root for resolving | - | y | y | y
368 /* direct refs use root == 0, key == NULL */
395 struct rb_node **p = &preftrees->direct.root.rb_root.rb_node;
418 static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path,
451 * 3. The leaf owner is not equal to the root we are searching
460 ret = btrfs_next_leaf(root, path);
462 ret = btrfs_next_old_leaf(root, path, time_seq);
478 * the leaf owner is not equal to the root we are searching for
484 ret = btrfs_next_leaf(root, path);
486 ret = btrfs_next_old_leaf(root, path, time_seq);
525 ret = btrfs_next_item(root, path);
527 ret = btrfs_next_old_item(root, path, time_seq);
547 struct btrfs_root *root;
558 * for the root, and if we don't find it then we need to search the
559 * tree_root's commit root, thus the btrfs_get_fs_root_commit_root usage
563 root = btrfs_get_fs_root_commit_root(fs_info, path, ref->root_id);
565 root = btrfs_get_fs_root(fs_info, ref->root_id, false);
566 if (IS_ERR(root)) {
567 ret = PTR_ERR(root);
572 test_bit(BTRFS_ROOT_DELETING, &root->state)) {
583 root_level = btrfs_header_level(root->commit_root);
585 root_level = btrfs_header_level(root->node);
587 root_level = btrfs_old_root_level(root, time_seq);
616 ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0);
618 ret = btrfs_search_old_slot(root, &search_key, path, time_seq);
621 "search slot in root %llu (level %d, ref count %d) returned %d for key (%llu %u %llu)",
638 ret = add_all_parents(root, path, parents, preftrees, ref, level,
641 btrfs_put_root(root);
707 while ((rnode = rb_first_cached(&preftrees->indirect.root))) {
717 rb_erase_cached(&ref->rbnode, &preftrees->indirect.root);
801 while ((node = rb_first_cached(&tree->root))) {
803 rb_erase_cached(node, &tree->root);
881 ret = add_indirect_ref(fs_info, preftrees, ref->root,
925 ret = add_indirect_ref(fs_info, preftrees, ref->root,
1047 u64 root;
1062 root = btrfs_extent_data_ref_root(leaf, dref);
1064 ret = add_indirect_ref(fs_info, preftrees, root,
1147 u64 root;
1163 root = btrfs_extent_data_ref_root(leaf, dref);
1164 ret = add_indirect_ref(fs_info, preftrees, root,
1188 * commit root.
1327 WARN_ON(!RB_EMPTY_ROOT(&preftrees.indirect_missing_keys.root.rb_root));
1334 WARN_ON(!RB_EMPTY_ROOT(&preftrees.indirect.root.rb_root));
1343 node = rb_first_cached(&preftrees.direct.root);
1364 /* no parent == root of tree */
1554 * circuit as soon as it finds a root or inode that doesn't match the
1564 int btrfs_check_shared(struct btrfs_root *root, u64 inum, u64 bytenr,
1567 struct btrfs_fs_info *fs_info = root->fs_info;
1574 .root_objectid = root->root_key.objectid,
1583 trans = btrfs_join_transaction_nostart(root);
1628 int btrfs_find_one_extref(struct btrfs_root *root, u64 inode_objectid,
1644 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
1661 ret = btrfs_next_leaf(root, path);
1912 * reads the tree block backref for an extent. tree level and root are returned
1964 u64 root, u64 extent_item_objectid,
1972 "ref for %llu resolved, key (%llu EXTEND_DATA %llu), root %llu",
1974 eie->offset, root);
1975 ret = iterate(eie->inum, eie->offset, root, ctx);
2042 "root %llu references leaf %llu, data list %#llx",
2067 static int build_ino_list(u64 inum, u64 offset, u64 root, void *ctx)
2076 inodes->val[inodes->elem_cnt + 2] = root;
2388 /* Current backref iterator only supports iteration in commit root */
2685 /* Only reloc root uses backref pointing to itself */
2687 struct btrfs_root *root;
2690 /* Only reloc backref cache cares about a specific root */
2692 root = find_reloc_root(cache->fs_info, cur->bytenr);
2693 if (!root)
2695 cur->root = root;
2698 * For generic purpose backref cache, reloc root node
2758 struct btrfs_root *root;
2764 root = btrfs_get_fs_root(fs_info, ref_key->offset, false);
2765 if (IS_ERR(root))
2766 return PTR_ERR(root);
2767 if (!test_bit(BTRFS_ROOT_SHAREABLE, &root->state))
2770 if (btrfs_root_level(&root->root_item) == cur->level) {
2771 /* Tree root */
2772 ASSERT(btrfs_root_bytenr(&root->root_item) == cur->bytenr);
2774 * For reloc backref cache, we may ignore reloc root. But for
2777 * current running relocation and lead to missing root.
2779 * For general purpose backref cache, reloc root detection is
2783 if (btrfs_should_ignore_reloc_root(root) && cache->is_reloc) {
2784 btrfs_put_root(root);
2787 cur->root = root;
2798 ret = btrfs_search_slot(NULL, root, tree_key, path, 0, 0);
2801 btrfs_put_root(root);
2811 cur->bytenr, level - 1, root->root_key.objectid,
2813 btrfs_put_root(root);
2822 ASSERT(btrfs_root_bytenr(&root->root_item) ==
2825 if (btrfs_should_ignore_reloc_root(root) &&
2827 btrfs_put_root(root);
2830 lower->root = root;
2837 btrfs_put_root(root);
2848 btrfs_put_root(root);
2854 if (!test_bit(BTRFS_ROOT_SHAREABLE, &root->state))
2861 if (btrfs_block_can_be_shared(root, eb))
2891 btrfs_put_root(root);
3020 * means the root objectid. We need to search the tree to get