Lines Matching defs:reloc_root

303 	 * trying to access reloc_root
323 if (!root->reloc_root)
330 struct btrfs_root *reloc_root;
339 reloc_root = root->reloc_root;
340 if (!reloc_root)
343 if (btrfs_header_generation(reloc_root->commit_root) ==
549 struct btrfs_root *reloc_root = src->reloc_root;
566 BUG_ON(node->new_bytenr != reloc_root->node->start);
571 reloc_root->commit_root->start);
742 struct btrfs_root *reloc_root;
818 reloc_root = btrfs_read_tree_root(fs_info->tree_root, &root_key);
819 if (IS_ERR(reloc_root)) {
820 ret = PTR_ERR(reloc_root);
823 set_bit(BTRFS_ROOT_SHAREABLE, &reloc_root->state);
824 reloc_root->last_trans = trans->transid;
825 return reloc_root;
838 * The reloc_root comes out of here with two references, one for
839 * root->reloc_root, and another for being on the rc->reloc_roots list.
845 struct btrfs_root *reloc_root;
869 if (root->reloc_root) {
870 reloc_root = root->reloc_root;
871 reloc_root->last_trans = trans->transid;
888 reloc_root = create_reloc_root(trans, root, root->root_key.objectid);
891 if (IS_ERR(reloc_root))
892 return PTR_ERR(reloc_root);
894 ret = __add_reloc_root(reloc_root);
898 btrfs_put_root(reloc_root);
901 root->reloc_root = btrfs_grab_root(reloc_root);
912 struct btrfs_root *reloc_root;
919 reloc_root = root->reloc_root;
920 root_item = &reloc_root->root_item;
924 * the root. We have the ref for root->reloc_root, but just in case
927 btrfs_grab_root(reloc_root);
929 /* root->reloc_root will stay until current relocation finished */
934 * Mark the tree as dead before we change reloc_root so
938 __del_reloc_root(reloc_root);
941 if (reloc_root->commit_root != reloc_root->node) {
942 __update_reloc_root(reloc_root);
943 btrfs_set_root_node(root_item, reloc_root->node);
944 free_extent_buffer(reloc_root->commit_root);
945 reloc_root->commit_root = btrfs_root_node(reloc_root);
949 &reloc_root->root_key, root_item);
950 btrfs_put_root(reloc_root);
1615 struct btrfs_root *reloc_root = root->reloc_root;
1621 ASSERT(reloc_root);
1623 reloc_root_item = &reloc_root->root_item;
1651 struct btrfs_root *reloc_root = root->reloc_root;
1654 root->reloc_root = NULL;
1657 * root->reloc_root = NULL. Pairs with have_reloc_root.
1661 if (reloc_root) {
1664 * ->reloc_root. If it fails however we must
1667 ret2 = btrfs_drop_snapshot(reloc_root, 0, 1);
1669 btrfs_put_root(reloc_root);
1699 struct btrfs_root *reloc_root;
1715 reloc_root = root->reloc_root;
1716 root_item = &reloc_root->root_item;
1720 atomic_inc(&reloc_root->node->refs);
1721 path->nodes[level] = reloc_root->node;
1729 ret = btrfs_search_slot(NULL, reloc_root, &key, path, 0, 0);
1778 reloc_root->last_trans = trans->transid;
1784 ret = walk_down_reloc_tree(reloc_root, path, &level);
1794 ret = replace_path(trans, rc, root, reloc_root, path,
1806 ret = walk_up_reloc_tree(reloc_root, path, &level);
1862 struct btrfs_root *reloc_root;
1902 reloc_root = list_entry(rc->reloc_roots.next,
1904 list_del_init(&reloc_root->root_list);
1906 root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset,
1913 list_add(&reloc_root->root_list, &reloc_roots);
1920 if (unlikely(root->reloc_root != reloc_root)) {
1921 if (root->reloc_root) {
1925 root->reloc_root->root_key.objectid,
1926 root->reloc_root->root_key.type,
1927 root->reloc_root->root_key.offset,
1929 &root->reloc_root->root_item),
1930 reloc_root->root_key.objectid,
1931 reloc_root->root_key.type,
1932 reloc_root->root_key.offset,
1934 &reloc_root->root_item));
1939 reloc_root->root_key.objectid,
1940 reloc_root->root_key.type,
1941 reloc_root->root_key.offset,
1943 &reloc_root->root_item));
1945 list_add(&reloc_root->root_list, &reloc_roots);
1958 btrfs_set_root_refs(&reloc_root->root_item, 1);
1965 list_add(&reloc_root->root_list, &reloc_roots);
1988 struct btrfs_root *reloc_root, *tmp;
1990 list_for_each_entry_safe(reloc_root, tmp, list, root_list)
1991 __del_reloc_root(reloc_root);
1999 struct btrfs_root *reloc_root;
2018 reloc_root = list_entry(reloc_roots.next,
2021 root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset,
2023 if (btrfs_root_refs(&reloc_root->root_item) > 0) {
2036 if (WARN_ON(root->reloc_root != reloc_root)) {
2047 if (list_empty(&reloc_root->root_list))
2048 list_add_tail(&reloc_root->root_list,
2054 if (root->reloc_root == reloc_root) {
2055 root->reloc_root = NULL;
2056 btrfs_put_root(reloc_root);
2063 list_del_init(&reloc_root->root_list);
2065 list_add_tail(&reloc_root->reloc_dirty_list,
2096 * do the reloc_dirty_list afterwards. Meanwhile the root->reloc_root
2115 struct btrfs_root *reloc_root)
2117 struct btrfs_fs_info *fs_info = reloc_root->fs_info;
2121 if (reloc_root->last_trans == trans->transid)
2124 root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, false);
2138 if (root->reloc_root != reloc_root) {
2142 reloc_root->root_key.offset);
2206 root = root->reloc_root;
2210 * 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;
3663 * extent tree is not a ref_cow tree and has no reloc_root to
4256 struct btrfs_root *reloc_root;
4293 reloc_root = btrfs_read_tree_root(fs_info->tree_root, &key);
4294 if (IS_ERR(reloc_root)) {
4295 err = PTR_ERR(reloc_root);
4299 set_bit(BTRFS_ROOT_SHAREABLE, &reloc_root->state);
4300 list_add(&reloc_root->root_list, &reloc_roots);
4302 if (btrfs_root_refs(&reloc_root->root_item) > 0) {
4304 reloc_root->root_key.offset, false);
4311 ret = mark_garbage_root(reloc_root);
4356 reloc_root = list_entry(reloc_roots.next,
4358 list_del(&reloc_root->root_list);
4360 if (btrfs_root_refs(&reloc_root->root_item) == 0) {
4361 list_add_tail(&reloc_root->root_list,
4366 fs_root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset,
4370 list_add_tail(&reloc_root->root_list, &reloc_roots);
4375 err = __add_reloc_root(reloc_root);
4378 list_add_tail(&reloc_root->root_list, &reloc_roots);
4383 fs_root->reloc_root = btrfs_grab_root(reloc_root);
4541 root = root->reloc_root;
4561 * references held on the reloc_root, one for root->reloc_root and one for
4568 struct btrfs_root *reloc_root;
4588 reloc_root = create_reloc_root(trans, root->reloc_root,
4590 if (IS_ERR(reloc_root))
4591 return PTR_ERR(reloc_root);
4593 ret = __add_reloc_root(reloc_root);
4597 btrfs_put_root(reloc_root);
4600 new_root->reloc_root = btrfs_grab_root(reloc_root);
4603 ret = clone_backref_node(trans, rc, root, reloc_root);