Lines Matching refs:reloc_root
315 if (!root->reloc_root) in have_reloc_root()
322 struct btrfs_root *reloc_root; in btrfs_should_ignore_reloc_root() local
331 reloc_root = root->reloc_root; in btrfs_should_ignore_reloc_root()
332 if (!reloc_root) in btrfs_should_ignore_reloc_root()
335 if (btrfs_header_generation(reloc_root->commit_root) == in btrfs_should_ignore_reloc_root()
540 struct btrfs_root *reloc_root = src->reloc_root; in clone_backref_node() local
557 BUG_ON(node->new_bytenr != reloc_root->node->start); in clone_backref_node()
562 reloc_root->commit_root->start); in clone_backref_node()
732 struct btrfs_root *reloc_root; in create_reloc_root() local
808 reloc_root = btrfs_read_tree_root(fs_info->tree_root, &root_key); in create_reloc_root()
809 if (IS_ERR(reloc_root)) { in create_reloc_root()
810 ret = PTR_ERR(reloc_root); in create_reloc_root()
813 set_bit(BTRFS_ROOT_SHAREABLE, &reloc_root->state); in create_reloc_root()
814 reloc_root->last_trans = trans->transid; in create_reloc_root()
815 return reloc_root; in create_reloc_root()
835 struct btrfs_root *reloc_root; in btrfs_init_reloc_root() local
859 if (root->reloc_root) { in btrfs_init_reloc_root()
860 reloc_root = root->reloc_root; in btrfs_init_reloc_root()
861 reloc_root->last_trans = trans->transid; in btrfs_init_reloc_root()
878 reloc_root = create_reloc_root(trans, root, root->root_key.objectid); in btrfs_init_reloc_root()
882 ret = __add_reloc_root(reloc_root); in btrfs_init_reloc_root()
884 root->reloc_root = btrfs_grab_root(reloc_root); in btrfs_init_reloc_root()
895 struct btrfs_root *reloc_root; in btrfs_update_reloc_root() local
902 reloc_root = root->reloc_root; in btrfs_update_reloc_root()
903 root_item = &reloc_root->root_item; in btrfs_update_reloc_root()
910 btrfs_grab_root(reloc_root); in btrfs_update_reloc_root()
921 __del_reloc_root(reloc_root); in btrfs_update_reloc_root()
924 if (reloc_root->commit_root != reloc_root->node) { in btrfs_update_reloc_root()
925 __update_reloc_root(reloc_root); in btrfs_update_reloc_root()
926 btrfs_set_root_node(root_item, reloc_root->node); in btrfs_update_reloc_root()
927 free_extent_buffer(reloc_root->commit_root); in btrfs_update_reloc_root()
928 reloc_root->commit_root = btrfs_root_node(reloc_root); in btrfs_update_reloc_root()
932 &reloc_root->root_key, root_item); in btrfs_update_reloc_root()
933 btrfs_put_root(reloc_root); in btrfs_update_reloc_root()
1586 struct btrfs_root *reloc_root = root->reloc_root; in insert_dirty_subvol() local
1591 ASSERT(reloc_root); in insert_dirty_subvol()
1593 reloc_root_item = &reloc_root->root_item; in insert_dirty_subvol()
1617 struct btrfs_root *reloc_root = root->reloc_root; in clean_dirty_subvols() local
1620 root->reloc_root = NULL; in clean_dirty_subvols()
1627 if (reloc_root) { in clean_dirty_subvols()
1633 ret2 = btrfs_drop_snapshot(reloc_root, 0, 1); in clean_dirty_subvols()
1635 btrfs_put_root(reloc_root); in clean_dirty_subvols()
1665 struct btrfs_root *reloc_root; in merge_reloc_root() local
1682 reloc_root = root->reloc_root; in merge_reloc_root()
1683 root_item = &reloc_root->root_item; in merge_reloc_root()
1687 atomic_inc(&reloc_root->node->refs); in merge_reloc_root()
1688 path->nodes[level] = reloc_root->node; in merge_reloc_root()
1696 ret = btrfs_search_slot(NULL, reloc_root, &key, path, 0, 0); in merge_reloc_root()
1746 reloc_root->last_trans = trans->transid; in merge_reloc_root()
1752 ret = walk_down_reloc_tree(reloc_root, path, &level); in merge_reloc_root()
1764 ret = replace_path(trans, rc, root, reloc_root, path, in merge_reloc_root()
1779 ret = walk_up_reloc_tree(reloc_root, path, &level); in merge_reloc_root()
1834 struct btrfs_root *reloc_root; in prepare_to_merge() local
1874 reloc_root = list_entry(rc->reloc_roots.next, in prepare_to_merge()
1876 list_del_init(&reloc_root->root_list); in prepare_to_merge()
1878 root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, in prepare_to_merge()
1881 BUG_ON(root->reloc_root != reloc_root); in prepare_to_merge()
1888 btrfs_set_root_refs(&reloc_root->root_item, 1); in prepare_to_merge()
1891 list_add(&reloc_root->root_list, &reloc_roots); in prepare_to_merge()
1907 struct btrfs_root *reloc_root, *tmp; in free_reloc_roots() local
1909 list_for_each_entry_safe(reloc_root, tmp, list, root_list) in free_reloc_roots()
1910 __del_reloc_root(reloc_root); in free_reloc_roots()
1918 struct btrfs_root *reloc_root; in merge_reloc_roots() local
1937 reloc_root = list_entry(reloc_roots.next, in merge_reloc_roots()
1940 root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, in merge_reloc_roots()
1942 if (btrfs_root_refs(&reloc_root->root_item) > 0) { in merge_reloc_roots()
1944 BUG_ON(root->reloc_root != reloc_root); in merge_reloc_roots()
1948 if (list_empty(&reloc_root->root_list)) in merge_reloc_roots()
1949 list_add_tail(&reloc_root->root_list, in merge_reloc_roots()
1955 if (root->reloc_root == reloc_root) { in merge_reloc_roots()
1956 root->reloc_root = NULL; in merge_reloc_roots()
1957 btrfs_put_root(reloc_root); in merge_reloc_roots()
1964 list_del_init(&reloc_root->root_list); in merge_reloc_roots()
1966 list_add_tail(&reloc_root->reloc_dirty_list, in merge_reloc_roots()
2016 struct btrfs_root *reloc_root) in record_reloc_root_in_trans() argument
2018 struct btrfs_fs_info *fs_info = reloc_root->fs_info; in record_reloc_root_in_trans()
2022 if (reloc_root->last_trans == trans->transid) in record_reloc_root_in_trans()
2025 root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, false); in record_reloc_root_in_trans()
2027 BUG_ON(root->reloc_root != reloc_root); in record_reloc_root_in_trans()
2058 root = root->reloc_root; in select_reloc_root()
2519 root = root->reloc_root; in relocate_tree_block()
3743 struct btrfs_root *reloc_root; in btrfs_recover_relocation() local
3780 reloc_root = btrfs_read_tree_root(root, &key); in btrfs_recover_relocation()
3781 if (IS_ERR(reloc_root)) { in btrfs_recover_relocation()
3782 err = PTR_ERR(reloc_root); in btrfs_recover_relocation()
3786 set_bit(BTRFS_ROOT_SHAREABLE, &reloc_root->state); in btrfs_recover_relocation()
3787 list_add(&reloc_root->root_list, &reloc_roots); in btrfs_recover_relocation()
3789 if (btrfs_root_refs(&reloc_root->root_item) > 0) { in btrfs_recover_relocation()
3791 reloc_root->root_key.offset, false); in btrfs_recover_relocation()
3798 ret = mark_garbage_root(reloc_root); in btrfs_recover_relocation()
3837 reloc_root = list_entry(reloc_roots.next, in btrfs_recover_relocation()
3839 list_del(&reloc_root->root_list); in btrfs_recover_relocation()
3841 if (btrfs_root_refs(&reloc_root->root_item) == 0) { in btrfs_recover_relocation()
3842 list_add_tail(&reloc_root->root_list, in btrfs_recover_relocation()
3847 fs_root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, in btrfs_recover_relocation()
3851 list_add_tail(&reloc_root->root_list, &reloc_roots); in btrfs_recover_relocation()
3856 err = __add_reloc_root(reloc_root); in btrfs_recover_relocation()
3858 fs_root->reloc_root = btrfs_grab_root(reloc_root); in btrfs_recover_relocation()
4019 root = root->reloc_root; in btrfs_reloc_pre_snapshot()
4046 struct btrfs_root *reloc_root; in btrfs_reloc_post_snapshot() local
4066 reloc_root = create_reloc_root(trans, root->reloc_root, in btrfs_reloc_post_snapshot()
4068 if (IS_ERR(reloc_root)) in btrfs_reloc_post_snapshot()
4069 return PTR_ERR(reloc_root); in btrfs_reloc_post_snapshot()
4071 ret = __add_reloc_root(reloc_root); in btrfs_reloc_post_snapshot()
4073 new_root->reloc_root = btrfs_grab_root(reloc_root); in btrfs_reloc_post_snapshot()
4076 ret = clone_backref_node(trans, rc, root, reloc_root); in btrfs_reloc_post_snapshot()