Lines Matching refs:root

38 #include "root-tree.h"
72 struct btrfs_root *root = btrfs_extent_root(fs_info, start);
84 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
302 * - Objectid of the subvolume root
444 struct btrfs_root *root = btrfs_extent_root(trans->fs_info, bytenr);
463 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
478 ret = btrfs_next_leaf(root, path);
518 struct btrfs_root *root = btrfs_extent_root(trans->fs_info, bytenr);
538 ret = btrfs_insert_empty_item(trans, root, path, &key, size);
564 ret = btrfs_insert_empty_item(trans, root, path, &key,
592 struct btrfs_root *root,
626 ret = btrfs_del_item(trans, root, path);
683 struct btrfs_root *root = btrfs_extent_root(trans->fs_info, bytenr);
696 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
707 struct btrfs_root *root = btrfs_extent_root(trans->fs_info, bytenr);
720 ret = btrfs_insert_empty_item(trans, root, path, &key, 0);
785 struct btrfs_root *root = btrfs_extent_root(fs_info, bytenr);
823 ret = btrfs_search_slot(trans, root, &key, path, extra_size, 1);
949 "overrun extent record at slot %d while looking for inline extent for root %llu owner %llu offset %llu parent %llu",
956 BTRFS_MAX_EXTENT_ITEM_SIZE(root)) {
1231 struct btrfs_root *root,
1243 ret = remove_extent_data_ref(trans, root, path, refs_to_drop);
1245 ret = btrfs_del_item(trans, root, path);
1524 u64 root = href->owning_root;
1531 !href->is_data || !is_fstree(root))
1534 btrfs_qgroup_free_refroot(fs_info, root, href->reserved_bytes,
1556 .root = href->owning_root,
1612 struct btrfs_root *root;
1641 root = btrfs_extent_root(fs_info, key.objectid);
1643 ret = btrfs_search_slot(trans, root, &key, path, 0, 1);
1722 .root = href->owning_root,
2139 static u64 find_middle(struct rb_root *root)
2141 struct rb_node *n = root->rb_node;
2147 n = rb_first(root);
2152 n = rb_last(root);
2157 n = root->rb_node;
2207 delayed_refs->run_delayed_start = find_middle(&delayed_refs->root);
2254 static noinline int check_delayed_ref(struct btrfs_root *root,
2265 spin_lock(&root->fs_info->trans_lock);
2266 cur_trans = root->fs_info->running_transaction;
2269 spin_unlock(&root->fs_info->trans_lock);
2330 if (ref->ref_root != btrfs_root_id(root) ||
2342 static noinline int check_committed_ref(struct btrfs_root *root,
2347 struct btrfs_fs_info *fs_info = root->fs_info;
2413 btrfs_root_last_snapshot(&root->root_item)))
2424 btrfs_extent_data_ref_root(leaf, ref) != btrfs_root_id(root) ||
2434 int btrfs_cross_ref_exist(struct btrfs_root *root, u64 objectid, u64 offset,
2440 ret = check_committed_ref(root, path, objectid,
2445 ret = check_delayed_ref(root, path, objectid, offset, bytenr);
2450 if (btrfs_is_data_reloc_root(root))
2456 struct btrfs_root *root,
2460 struct btrfs_fs_info *fs_info = root->fs_info;
2479 if (!test_bit(BTRFS_ROOT_SHAREABLE, &root->state) && level == 0)
2516 btrfs_root_id(root), for_reloc);
2529 btrfs_root_id(root), for_reloc);
2543 int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
2546 return __btrfs_mod_ref(trans, root, buf, full_backref, 1);
2549 int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
2552 return __btrfs_mod_ref(trans, root, buf, full_backref, 0);
2555 static u64 get_alloc_profile_by_root(struct btrfs_root *root, int data)
2557 struct btrfs_fs_info *fs_info = root->fs_info;
2563 else if (root == fs_info->chunk_root)
2918 * Returns the objectid of the root that originally allocated the extent item
2949 /* We found an owner ref, get the root out of it. */
3023 * extent data backref root FS_TREE objectid 258 offset 0 count 1
3024 * extent data backref root FS_TREE objectid 257 offset 0 count 1
3039 * extent data backref root FS_TREE objectid 258 offset 0 count 1
3049 * extent data backref root FS_TREE objectid 866 offset 0 count 1
3217 "unable to find ref byte nr %llu parent %llu root %llu owner %llu offset %llu slot %d",
3294 .root = delayed_ref_root,
3347 delta.root = btrfs_get_extent_owner_root(trans->fs_info,
3479 * existed in a completely different root. For example if it
3480 * was part of root A, then was reallocated to root B, and we
3481 * are doing a btrfs_old_search_slot(root b), we could replay
3482 * operations that happened when the block was part of root A,
3486 * node or root points to this extent buffer, so if after this
4131 struct btrfs_root *root = fs_info->chunk_root;
4176 trans = btrfs_join_transaction(root);
4363 static noinline int find_free_extent(struct btrfs_root *root,
4367 struct btrfs_fs_info *fs_info = root->fs_info;
4400 trace_find_free_extent(root, ffe_ctl);
4451 trace_find_free_extent_search_loop(root, ffe_ctl);
4503 trace_find_free_extent_have_block_group(root, ffe_ctl, block_group);
4621 * @root - The root that will contain this extent
4662 int btrfs_reserve_extent(struct btrfs_root *root, u64 ram_bytes,
4667 struct btrfs_fs_info *fs_info = root->fs_info;
4672 bool for_treelog = (btrfs_root_id(root) == BTRFS_TREE_LOG_OBJECTID);
4673 bool for_data_reloc = (btrfs_is_data_reloc_root(root) && is_data);
4675 flags = get_alloc_profile_by_root(root, is_data);
4689 ret = find_free_extent(root, ins, &ffe_ctl);
4929 struct btrfs_root *root, u64 owner,
4937 .owning_root = btrfs_root_id(root),
4938 .ref_root = btrfs_root_id(root),
4943 if (btrfs_is_data_reloc_root(root) && is_fstree(root->relocation_src_root))
4944 generic_ref.owning_root = root->relocation_src_root;
4947 btrfs_ref_tree_mod(root->fs_info, &generic_ref);
4966 .root = root_objectid,
5028 btrfs_init_new_buffer(struct btrfs_trans_handle *trans, struct btrfs_root *root,
5032 struct btrfs_fs_info *fs_info = root->fs_info;
5050 * hold the lock on the original fs root and then search for the reloc
5051 * root. At that point we need to make sure any reloc root buffers are
5056 !test_bit(BTRFS_ROOT_RESET_LOCKDEP_CLASS, &root->state))
5084 if (btrfs_root_id(root) == BTRFS_TREE_LOG_OBJECTID) {
5085 buf->log_index = root->log_transid % 2;
5091 set_extent_bit(&root->dirty_log_pages, buf->start,
5095 set_extent_bit(&root->dirty_log_pages, buf->start,
5112 struct btrfs_root *root,
5120 struct btrfs_fs_info *fs_info = root->fs_info;
5133 buf = btrfs_init_new_buffer(trans, root, root->alloc_bytenr,
5136 root->alloc_bytenr += blocksize;
5141 block_rsv = btrfs_use_block_rsv(trans, root, blocksize);
5145 ret = btrfs_reserve_extent(root, blocksize, blocksize, blocksize,
5150 buf = btrfs_init_new_buffer(trans, root, ins.objectid, level,
5189 btrfs_init_tree_ref(&generic_ref, level, btrfs_root_id(root), false);
5229 struct btrfs_root *root,
5233 struct btrfs_fs_info *fs_info = root->fs_info;
5269 generation <= root->root_key.offset)
5289 generation <= root->root_key.offset)
5317 struct btrfs_root *root,
5321 struct btrfs_fs_info *fs_info = root->fs_info;
5327 if (wc->stage == UPDATE_BACKREF && btrfs_header_owner(eb) != btrfs_root_id(root))
5363 ret = btrfs_inc_ref(trans, root, eb, 1);
5365 ret = btrfs_dec_ref(trans, root, eb, 0);
5384 * This is used to verify a ref exists for this root to deal with a bug where we
5388 struct btrfs_root *root, u64 bytenr, u64 parent,
5400 root->fs_info->nodesize, parent,
5401 btrfs_root_id(root), level, 0);
5424 struct btrfs_root *root,
5428 struct btrfs_fs_info *fs_info = root->fs_info;
5448 generation <= root->root_key.offset) {
5457 check.owner_root = btrfs_root_id(root);
5465 btrfs_root_id(root), level - 1);
5494 generation <= root->root_key.offset)
5521 reada_walk_down(trans, root, wc, path);
5535 btrfs_err(root->fs_info, "mismatched level");
5555 .ref_root = btrfs_root_id(root),
5560 ASSERT(btrfs_root_id(root) ==
5562 if (btrfs_root_id(root) !=
5564 btrfs_err(root->fs_info,
5578 ret = check_ref_exists(trans, root, bytenr, ref.parent,
5593 if (btrfs_root_id(root) != BTRFS_TREE_RELOC_OBJECTID && need_account) {
5641 struct btrfs_root *root,
5645 struct btrfs_fs_info *fs_info = root->fs_info;
5699 ret = btrfs_dec_ref(trans, root, eb, 1);
5701 ret = btrfs_dec_ref(trans, root, eb, 0);
5703 if (is_fstree(btrfs_root_id(root))) {
5720 if (eb == root->node) {
5723 else if (btrfs_root_id(root) != btrfs_header_owner(eb))
5728 else if (btrfs_root_id(root) !=
5733 btrfs_free_tree_block(trans, btrfs_root_id(root), eb, parent,
5742 btrfs_header_owner(eb), btrfs_root_id(root));
5747 struct btrfs_root *root,
5756 ret = walk_down_proc(trans, root, path, wc, lookup_info);
5767 ret = do_walk_down(trans, root, path, wc, &lookup_info);
5779 struct btrfs_root *root,
5794 ret = walk_up_proc(trans, root, path, wc);
5826 int btrfs_drop_snapshot(struct btrfs_root *root, int update_ref, int for_reloc)
5828 const bool is_reloc_root = (btrfs_root_id(root) == BTRFS_TREE_RELOC_OBJECTID);
5829 struct btrfs_fs_info *fs_info = root->fs_info;
5833 struct btrfs_root_item *root_item = &root->root_item;
5842 btrfs_debug(fs_info, "Drop subvolume %llu", btrfs_root_id(root));
5877 * dropped as we unlock the root node and parent nodes as we walk down
5882 set_bit(BTRFS_ROOT_DELETING, &root->state);
5883 unfinished_drop = test_bit(BTRFS_ROOT_UNFINISHED_DROP, &root->state);
5886 level = btrfs_header_level(root->node);
5887 path->nodes[level] = btrfs_lock_root_node(root);
5900 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
5914 level = btrfs_header_level(root->node);
5939 wc->restarted = test_bit(BTRFS_ROOT_DEAD_TREE, &root->state);
5949 ret = walk_down_tree(trans, root, path, wc);
5956 ret = walk_up_tree(trans, root, path, wc, BTRFS_MAX_LEVEL);
5982 &root->root_key,
6020 ret = btrfs_del_root(trans, &root->root_key);
6028 ret = btrfs_find_root(tree_root, &root->root_key, path,
6040 btrfs_del_orphan_item(trans, tree_root, btrfs_root_id(root));
6049 btrfs_qgroup_convert_reserved_meta(root, INT_MAX);
6050 btrfs_qgroup_free_meta_all_pertrans(root);
6052 if (test_bit(BTRFS_ROOT_IN_RADIX, &root->state))
6053 btrfs_add_dropped_root(trans, root);
6055 btrfs_put_root(root);
6067 * We were an unfinished drop root, check to see if there are any
6075 * need to make sure to add it back to the dead root list so that we
6081 btrfs_add_dead_root(root);
6092 struct btrfs_root *root,
6096 struct btrfs_fs_info *fs_info = root->fs_info;
6103 BUG_ON(btrfs_root_id(root) != BTRFS_TREE_RELOC_OBJECTID);
6137 ret = walk_down_tree(trans, root, path, wc);
6141 ret = walk_up_tree(trans, root, path, wc, parent_level);
6179 * transaction and hold the commit root sem. We only need to hold