Lines Matching refs:reloc_root
327 if (!root->reloc_root) in have_reloc_root()
334 struct btrfs_root *reloc_root; in btrfs_should_ignore_reloc_root() local
343 reloc_root = root->reloc_root; in btrfs_should_ignore_reloc_root()
344 if (!reloc_root) in btrfs_should_ignore_reloc_root()
347 if (btrfs_header_generation(reloc_root->commit_root) == in btrfs_should_ignore_reloc_root()
553 struct btrfs_root *reloc_root = src->reloc_root; in clone_backref_node() local
570 BUG_ON(node->new_bytenr != reloc_root->node->start); in clone_backref_node()
575 reloc_root->commit_root->start); in clone_backref_node()
746 struct btrfs_root *reloc_root; in create_reloc_root() local
822 reloc_root = btrfs_read_tree_root(fs_info->tree_root, &root_key); in create_reloc_root()
823 if (IS_ERR(reloc_root)) { in create_reloc_root()
824 ret = PTR_ERR(reloc_root); in create_reloc_root()
827 set_bit(BTRFS_ROOT_SHAREABLE, &reloc_root->state); in create_reloc_root()
828 reloc_root->last_trans = trans->transid; in create_reloc_root()
829 return reloc_root; in create_reloc_root()
849 struct btrfs_root *reloc_root; in btrfs_init_reloc_root() local
873 if (root->reloc_root) { in btrfs_init_reloc_root()
874 reloc_root = root->reloc_root; in btrfs_init_reloc_root()
875 reloc_root->last_trans = trans->transid; in btrfs_init_reloc_root()
892 reloc_root = create_reloc_root(trans, root, root->root_key.objectid); in btrfs_init_reloc_root()
895 if (IS_ERR(reloc_root)) in btrfs_init_reloc_root()
896 return PTR_ERR(reloc_root); in btrfs_init_reloc_root()
898 ret = __add_reloc_root(reloc_root); in btrfs_init_reloc_root()
902 btrfs_put_root(reloc_root); in btrfs_init_reloc_root()
905 root->reloc_root = btrfs_grab_root(reloc_root); in btrfs_init_reloc_root()
916 struct btrfs_root *reloc_root; in btrfs_update_reloc_root() local
923 reloc_root = root->reloc_root; in btrfs_update_reloc_root()
924 root_item = &reloc_root->root_item; in btrfs_update_reloc_root()
931 btrfs_grab_root(reloc_root); in btrfs_update_reloc_root()
942 __del_reloc_root(reloc_root); in btrfs_update_reloc_root()
945 if (reloc_root->commit_root != reloc_root->node) { in btrfs_update_reloc_root()
946 __update_reloc_root(reloc_root); in btrfs_update_reloc_root()
947 btrfs_set_root_node(root_item, reloc_root->node); in btrfs_update_reloc_root()
948 free_extent_buffer(reloc_root->commit_root); in btrfs_update_reloc_root()
949 reloc_root->commit_root = btrfs_root_node(reloc_root); in btrfs_update_reloc_root()
953 &reloc_root->root_key, root_item); in btrfs_update_reloc_root()
954 btrfs_put_root(reloc_root); in btrfs_update_reloc_root()
1616 struct btrfs_root *reloc_root = root->reloc_root; in insert_dirty_subvol() local
1622 ASSERT(reloc_root); in insert_dirty_subvol()
1624 reloc_root_item = &reloc_root->root_item; in insert_dirty_subvol()
1652 struct btrfs_root *reloc_root = root->reloc_root; in clean_dirty_subvols() local
1655 root->reloc_root = NULL; in clean_dirty_subvols()
1662 if (reloc_root) { in clean_dirty_subvols()
1668 ret2 = btrfs_drop_snapshot(reloc_root, 0, 1); in clean_dirty_subvols()
1670 btrfs_put_root(reloc_root); in clean_dirty_subvols()
1700 struct btrfs_root *reloc_root; in merge_reloc_root() local
1716 reloc_root = root->reloc_root; in merge_reloc_root()
1717 root_item = &reloc_root->root_item; in merge_reloc_root()
1721 atomic_inc(&reloc_root->node->refs); in merge_reloc_root()
1722 path->nodes[level] = reloc_root->node; in merge_reloc_root()
1730 ret = btrfs_search_slot(NULL, reloc_root, &key, path, 0, 0); in merge_reloc_root()
1779 reloc_root->last_trans = trans->transid; in merge_reloc_root()
1785 ret = walk_down_reloc_tree(reloc_root, path, &level); in merge_reloc_root()
1795 ret = replace_path(trans, rc, root, reloc_root, path, in merge_reloc_root()
1807 ret = walk_up_reloc_tree(reloc_root, path, &level); in merge_reloc_root()
1863 struct btrfs_root *reloc_root; in prepare_to_merge() local
1903 reloc_root = list_entry(rc->reloc_roots.next, in prepare_to_merge()
1905 list_del_init(&reloc_root->root_list); in prepare_to_merge()
1907 root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, in prepare_to_merge()
1914 list_add(&reloc_root->root_list, &reloc_roots); in prepare_to_merge()
1921 if (unlikely(root->reloc_root != reloc_root)) { in prepare_to_merge()
1922 if (root->reloc_root) { in prepare_to_merge()
1926 root->reloc_root->root_key.objectid, in prepare_to_merge()
1927 root->reloc_root->root_key.type, in prepare_to_merge()
1928 root->reloc_root->root_key.offset, in prepare_to_merge()
1930 &root->reloc_root->root_item), in prepare_to_merge()
1931 reloc_root->root_key.objectid, in prepare_to_merge()
1932 reloc_root->root_key.type, in prepare_to_merge()
1933 reloc_root->root_key.offset, in prepare_to_merge()
1935 &reloc_root->root_item)); in prepare_to_merge()
1940 reloc_root->root_key.objectid, in prepare_to_merge()
1941 reloc_root->root_key.type, in prepare_to_merge()
1942 reloc_root->root_key.offset, in prepare_to_merge()
1944 &reloc_root->root_item)); in prepare_to_merge()
1946 list_add(&reloc_root->root_list, &reloc_roots); in prepare_to_merge()
1959 btrfs_set_root_refs(&reloc_root->root_item, 1); in prepare_to_merge()
1966 list_add(&reloc_root->root_list, &reloc_roots); in prepare_to_merge()
1989 struct btrfs_root *reloc_root, *tmp; in free_reloc_roots() local
1991 list_for_each_entry_safe(reloc_root, tmp, list, root_list) in free_reloc_roots()
1992 __del_reloc_root(reloc_root); in free_reloc_roots()
2000 struct btrfs_root *reloc_root; in merge_reloc_roots() local
2019 reloc_root = list_entry(reloc_roots.next, in merge_reloc_roots()
2022 root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, in merge_reloc_roots()
2024 if (btrfs_root_refs(&reloc_root->root_item) > 0) { in merge_reloc_roots()
2037 if (WARN_ON(root->reloc_root != reloc_root)) { in merge_reloc_roots()
2048 if (list_empty(&reloc_root->root_list)) in merge_reloc_roots()
2049 list_add_tail(&reloc_root->root_list, in merge_reloc_roots()
2055 if (root->reloc_root == reloc_root) { in merge_reloc_roots()
2056 root->reloc_root = NULL; in merge_reloc_roots()
2057 btrfs_put_root(reloc_root); in merge_reloc_roots()
2064 list_del_init(&reloc_root->root_list); in merge_reloc_roots()
2066 list_add_tail(&reloc_root->reloc_dirty_list, in merge_reloc_roots()
2116 struct btrfs_root *reloc_root) in record_reloc_root_in_trans() argument
2118 struct btrfs_fs_info *fs_info = reloc_root->fs_info; in record_reloc_root_in_trans()
2122 if (reloc_root->last_trans == trans->transid) in record_reloc_root_in_trans()
2125 root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, false); in record_reloc_root_in_trans()
2139 if (root->reloc_root != reloc_root) { in record_reloc_root_in_trans()
2143 reloc_root->root_key.offset); in record_reloc_root_in_trans()
2207 root = root->reloc_root; in select_reloc_root()
2735 if (!root->reloc_root) { in relocate_tree_block()
2739 root = root->reloc_root; in relocate_tree_block()
4209 struct btrfs_root *reloc_root; in btrfs_recover_relocation() local
4246 reloc_root = btrfs_read_tree_root(fs_info->tree_root, &key); in btrfs_recover_relocation()
4247 if (IS_ERR(reloc_root)) { in btrfs_recover_relocation()
4248 err = PTR_ERR(reloc_root); in btrfs_recover_relocation()
4252 set_bit(BTRFS_ROOT_SHAREABLE, &reloc_root->state); in btrfs_recover_relocation()
4253 list_add(&reloc_root->root_list, &reloc_roots); in btrfs_recover_relocation()
4255 if (btrfs_root_refs(&reloc_root->root_item) > 0) { in btrfs_recover_relocation()
4257 reloc_root->root_key.offset, false); in btrfs_recover_relocation()
4264 ret = mark_garbage_root(reloc_root); in btrfs_recover_relocation()
4309 reloc_root = list_entry(reloc_roots.next, in btrfs_recover_relocation()
4311 list_del(&reloc_root->root_list); in btrfs_recover_relocation()
4313 if (btrfs_root_refs(&reloc_root->root_item) == 0) { in btrfs_recover_relocation()
4314 list_add_tail(&reloc_root->root_list, in btrfs_recover_relocation()
4319 fs_root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, in btrfs_recover_relocation()
4323 list_add_tail(&reloc_root->root_list, &reloc_roots); in btrfs_recover_relocation()
4328 err = __add_reloc_root(reloc_root); in btrfs_recover_relocation()
4331 list_add_tail(&reloc_root->root_list, &reloc_roots); in btrfs_recover_relocation()
4336 fs_root->reloc_root = btrfs_grab_root(reloc_root); in btrfs_recover_relocation()
4493 root = root->reloc_root; in btrfs_reloc_pre_snapshot()
4520 struct btrfs_root *reloc_root; in btrfs_reloc_post_snapshot() local
4540 reloc_root = create_reloc_root(trans, root->reloc_root, in btrfs_reloc_post_snapshot()
4542 if (IS_ERR(reloc_root)) in btrfs_reloc_post_snapshot()
4543 return PTR_ERR(reloc_root); in btrfs_reloc_post_snapshot()
4545 ret = __add_reloc_root(reloc_root); in btrfs_reloc_post_snapshot()
4549 btrfs_put_root(reloc_root); in btrfs_reloc_post_snapshot()
4552 new_root->reloc_root = btrfs_grab_root(reloc_root); in btrfs_reloc_post_snapshot()
4555 ret = clone_backref_node(trans, rc, root, reloc_root); in btrfs_reloc_post_snapshot()