Lines Matching refs:reloc_root
307 * trying to access reloc_root
327 if (!root->reloc_root)
334 struct btrfs_root *reloc_root;
343 reloc_root = root->reloc_root;
344 if (!reloc_root)
347 if (btrfs_header_generation(reloc_root->commit_root) ==
553 struct btrfs_root *reloc_root = src->reloc_root;
570 BUG_ON(node->new_bytenr != reloc_root->node->start);
575 reloc_root->commit_root->start);
746 struct btrfs_root *reloc_root;
822 reloc_root = btrfs_read_tree_root(fs_info->tree_root, &root_key);
823 if (IS_ERR(reloc_root)) {
824 ret = PTR_ERR(reloc_root);
827 set_bit(BTRFS_ROOT_SHAREABLE, &reloc_root->state);
828 reloc_root->last_trans = trans->transid;
829 return reloc_root;
842 * The reloc_root comes out of here with two references, one for
843 * root->reloc_root, and another for being on the rc->reloc_roots list.
849 struct btrfs_root *reloc_root;
873 if (root->reloc_root) {
874 reloc_root = root->reloc_root;
875 reloc_root->last_trans = trans->transid;
892 reloc_root = create_reloc_root(trans, root, root->root_key.objectid);
895 if (IS_ERR(reloc_root))
896 return PTR_ERR(reloc_root);
898 ret = __add_reloc_root(reloc_root);
902 btrfs_put_root(reloc_root);
905 root->reloc_root = btrfs_grab_root(reloc_root);
916 struct btrfs_root *reloc_root;
923 reloc_root = root->reloc_root;
924 root_item = &reloc_root->root_item;
928 * the root. We have the ref for root->reloc_root, but just in case
931 btrfs_grab_root(reloc_root);
933 /* root->reloc_root will stay until current relocation finished */
938 * Mark the tree as dead before we change reloc_root so
942 __del_reloc_root(reloc_root);
945 if (reloc_root->commit_root != reloc_root->node) {
946 __update_reloc_root(reloc_root);
947 btrfs_set_root_node(root_item, reloc_root->node);
948 free_extent_buffer(reloc_root->commit_root);
949 reloc_root->commit_root = btrfs_root_node(reloc_root);
953 &reloc_root->root_key, root_item);
954 btrfs_put_root(reloc_root);
1616 struct btrfs_root *reloc_root = root->reloc_root;
1622 ASSERT(reloc_root);
1624 reloc_root_item = &reloc_root->root_item;
1652 struct btrfs_root *reloc_root = root->reloc_root;
1655 root->reloc_root = NULL;
1658 * root->reloc_root = NULL. Pairs with have_reloc_root.
1662 if (reloc_root) {
1665 * ->reloc_root. If it fails however we must
1668 ret2 = btrfs_drop_snapshot(reloc_root, 0, 1);
1670 btrfs_put_root(reloc_root);
1700 struct btrfs_root *reloc_root;
1716 reloc_root = root->reloc_root;
1717 root_item = &reloc_root->root_item;
1721 atomic_inc(&reloc_root->node->refs);
1722 path->nodes[level] = reloc_root->node;
1730 ret = btrfs_search_slot(NULL, reloc_root, &key, path, 0, 0);
1779 reloc_root->last_trans = trans->transid;
1785 ret = walk_down_reloc_tree(reloc_root, path, &level);
1795 ret = replace_path(trans, rc, root, reloc_root, path,
1807 ret = walk_up_reloc_tree(reloc_root, path, &level);
1863 struct btrfs_root *reloc_root;
1903 reloc_root = list_entry(rc->reloc_roots.next,
1905 list_del_init(&reloc_root->root_list);
1907 root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset,
1914 list_add(&reloc_root->root_list, &reloc_roots);
1921 if (unlikely(root->reloc_root != reloc_root)) {
1922 if (root->reloc_root) {
1926 root->reloc_root->root_key.objectid,
1927 root->reloc_root->root_key.type,
1928 root->reloc_root->root_key.offset,
1930 &root->reloc_root->root_item),
1931 reloc_root->root_key.objectid,
1932 reloc_root->root_key.type,
1933 reloc_root->root_key.offset,
1935 &reloc_root->root_item));
1940 reloc_root->root_key.objectid,
1941 reloc_root->root_key.type,
1942 reloc_root->root_key.offset,
1944 &reloc_root->root_item));
1946 list_add(&reloc_root->root_list, &reloc_roots);
1959 btrfs_set_root_refs(&reloc_root->root_item, 1);
1966 list_add(&reloc_root->root_list, &reloc_roots);
1989 struct btrfs_root *reloc_root, *tmp;
1991 list_for_each_entry_safe(reloc_root, tmp, list, root_list)
1992 __del_reloc_root(reloc_root);
2000 struct btrfs_root *reloc_root;
2019 reloc_root = list_entry(reloc_roots.next,
2022 root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset,
2024 if (btrfs_root_refs(&reloc_root->root_item) > 0) {
2037 if (WARN_ON(root->reloc_root != reloc_root)) {
2048 if (list_empty(&reloc_root->root_list))
2049 list_add_tail(&reloc_root->root_list,
2055 if (root->reloc_root == reloc_root) {
2056 root->reloc_root = NULL;
2057 btrfs_put_root(reloc_root);
2064 list_del_init(&reloc_root->root_list);
2066 list_add_tail(&reloc_root->reloc_dirty_list,
2097 * do the reloc_dirty_list afterwards. Meanwhile the root->reloc_root
2116 struct btrfs_root *reloc_root)
2118 struct btrfs_fs_info *fs_info = reloc_root->fs_info;
2122 if (reloc_root->last_trans == trans->transid)
2125 root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, false);
2139 if (root->reloc_root != reloc_root) {
2143 reloc_root->root_key.offset);
2207 root = root->reloc_root;
2211 * root->reloc_root may not be set, return ENOENT in this case.
2733 * have reloc_root actually set.
2735 if (!root->reloc_root) {
2739 root = root->reloc_root;
3632 * extent tree is not a ref_cow tree and has no reloc_root to
4209 struct btrfs_root *reloc_root;
4246 reloc_root = btrfs_read_tree_root(fs_info->tree_root, &key);
4247 if (IS_ERR(reloc_root)) {
4248 err = PTR_ERR(reloc_root);
4252 set_bit(BTRFS_ROOT_SHAREABLE, &reloc_root->state);
4253 list_add(&reloc_root->root_list, &reloc_roots);
4255 if (btrfs_root_refs(&reloc_root->root_item) > 0) {
4257 reloc_root->root_key.offset, false);
4264 ret = mark_garbage_root(reloc_root);
4309 reloc_root = list_entry(reloc_roots.next,
4311 list_del(&reloc_root->root_list);
4313 if (btrfs_root_refs(&reloc_root->root_item) == 0) {
4314 list_add_tail(&reloc_root->root_list,
4319 fs_root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset,
4323 list_add_tail(&reloc_root->root_list, &reloc_roots);
4328 err = __add_reloc_root(reloc_root);
4331 list_add_tail(&reloc_root->root_list, &reloc_roots);
4336 fs_root->reloc_root = btrfs_grab_root(reloc_root);
4493 root = root->reloc_root;
4513 * references held on the reloc_root, one for root->reloc_root and one for
4520 struct btrfs_root *reloc_root;
4540 reloc_root = create_reloc_root(trans, root->reloc_root,
4542 if (IS_ERR(reloc_root))
4543 return PTR_ERR(reloc_root);
4545 ret = __add_reloc_root(reloc_root);
4549 btrfs_put_root(reloc_root);
4552 new_root->reloc_root = btrfs_grab_root(reloc_root);
4555 ret = clone_backref_node(trans, rc, root, reloc_root);