Lines Matching refs:reloc_root
317 if (!root->reloc_root) in have_reloc_root()
324 struct btrfs_root *reloc_root; in btrfs_should_ignore_reloc_root() local
333 reloc_root = root->reloc_root; in btrfs_should_ignore_reloc_root()
334 if (!reloc_root) in btrfs_should_ignore_reloc_root()
337 if (btrfs_header_generation(reloc_root->commit_root) == in btrfs_should_ignore_reloc_root()
542 struct btrfs_root *reloc_root = src->reloc_root; in clone_backref_node() local
559 BUG_ON(node->new_bytenr != reloc_root->node->start); in clone_backref_node()
564 reloc_root->commit_root->start); in clone_backref_node()
735 struct btrfs_root *reloc_root; in create_reloc_root() local
811 reloc_root = btrfs_read_tree_root(fs_info->tree_root, &root_key); in create_reloc_root()
812 if (IS_ERR(reloc_root)) { in create_reloc_root()
813 ret = PTR_ERR(reloc_root); in create_reloc_root()
816 set_bit(BTRFS_ROOT_SHAREABLE, &reloc_root->state); in create_reloc_root()
817 reloc_root->last_trans = trans->transid; in create_reloc_root()
818 return reloc_root; in create_reloc_root()
838 struct btrfs_root *reloc_root; in btrfs_init_reloc_root() local
862 if (root->reloc_root) { in btrfs_init_reloc_root()
863 reloc_root = root->reloc_root; in btrfs_init_reloc_root()
864 reloc_root->last_trans = trans->transid; in btrfs_init_reloc_root()
881 reloc_root = create_reloc_root(trans, root, root->root_key.objectid); in btrfs_init_reloc_root()
884 if (IS_ERR(reloc_root)) in btrfs_init_reloc_root()
885 return PTR_ERR(reloc_root); in btrfs_init_reloc_root()
887 ret = __add_reloc_root(reloc_root); in btrfs_init_reloc_root()
891 btrfs_put_root(reloc_root); in btrfs_init_reloc_root()
894 root->reloc_root = btrfs_grab_root(reloc_root); in btrfs_init_reloc_root()
905 struct btrfs_root *reloc_root; in btrfs_update_reloc_root() local
912 reloc_root = root->reloc_root; in btrfs_update_reloc_root()
913 root_item = &reloc_root->root_item; in btrfs_update_reloc_root()
920 btrfs_grab_root(reloc_root); in btrfs_update_reloc_root()
931 __del_reloc_root(reloc_root); in btrfs_update_reloc_root()
934 if (reloc_root->commit_root != reloc_root->node) { in btrfs_update_reloc_root()
935 __update_reloc_root(reloc_root); in btrfs_update_reloc_root()
936 btrfs_set_root_node(root_item, reloc_root->node); in btrfs_update_reloc_root()
937 free_extent_buffer(reloc_root->commit_root); in btrfs_update_reloc_root()
938 reloc_root->commit_root = btrfs_root_node(reloc_root); in btrfs_update_reloc_root()
942 &reloc_root->root_key, root_item); in btrfs_update_reloc_root()
943 btrfs_put_root(reloc_root); in btrfs_update_reloc_root()
1598 struct btrfs_root *reloc_root = root->reloc_root; in insert_dirty_subvol() local
1604 ASSERT(reloc_root); in insert_dirty_subvol()
1606 reloc_root_item = &reloc_root->root_item; in insert_dirty_subvol()
1634 struct btrfs_root *reloc_root = root->reloc_root; in clean_dirty_subvols() local
1637 root->reloc_root = NULL; in clean_dirty_subvols()
1644 if (reloc_root) { in clean_dirty_subvols()
1650 ret2 = btrfs_drop_snapshot(reloc_root, 0, 1); in clean_dirty_subvols()
1652 btrfs_put_root(reloc_root); in clean_dirty_subvols()
1682 struct btrfs_root *reloc_root; in merge_reloc_root() local
1698 reloc_root = root->reloc_root; in merge_reloc_root()
1699 root_item = &reloc_root->root_item; in merge_reloc_root()
1703 atomic_inc(&reloc_root->node->refs); in merge_reloc_root()
1704 path->nodes[level] = reloc_root->node; in merge_reloc_root()
1712 ret = btrfs_search_slot(NULL, reloc_root, &key, path, 0, 0); in merge_reloc_root()
1760 reloc_root->last_trans = trans->transid; in merge_reloc_root()
1766 ret = walk_down_reloc_tree(reloc_root, path, &level); in merge_reloc_root()
1776 ret = replace_path(trans, rc, root, reloc_root, path, in merge_reloc_root()
1788 ret = walk_up_reloc_tree(reloc_root, path, &level); in merge_reloc_root()
1844 struct btrfs_root *reloc_root; in prepare_to_merge() local
1884 reloc_root = list_entry(rc->reloc_roots.next, in prepare_to_merge()
1886 list_del_init(&reloc_root->root_list); in prepare_to_merge()
1888 root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, in prepare_to_merge()
1895 list_add(&reloc_root->root_list, &reloc_roots); in prepare_to_merge()
1901 ASSERT(root->reloc_root == reloc_root); in prepare_to_merge()
1908 btrfs_set_root_refs(&reloc_root->root_item, 1); in prepare_to_merge()
1915 list_add(&reloc_root->root_list, &reloc_roots); in prepare_to_merge()
1938 struct btrfs_root *reloc_root, *tmp; in free_reloc_roots() local
1940 list_for_each_entry_safe(reloc_root, tmp, list, root_list) in free_reloc_roots()
1941 __del_reloc_root(reloc_root); in free_reloc_roots()
1949 struct btrfs_root *reloc_root; in merge_reloc_roots() local
1968 reloc_root = list_entry(reloc_roots.next, in merge_reloc_roots()
1971 root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, in merge_reloc_roots()
1973 if (btrfs_root_refs(&reloc_root->root_item) > 0) { in merge_reloc_roots()
1987 if (root->reloc_root != reloc_root) { in merge_reloc_roots()
2000 if (list_empty(&reloc_root->root_list)) in merge_reloc_roots()
2001 list_add_tail(&reloc_root->root_list, in merge_reloc_roots()
2007 if (root->reloc_root == reloc_root) { in merge_reloc_roots()
2008 root->reloc_root = NULL; in merge_reloc_roots()
2009 btrfs_put_root(reloc_root); in merge_reloc_roots()
2016 list_del_init(&reloc_root->root_list); in merge_reloc_roots()
2018 list_add_tail(&reloc_root->reloc_dirty_list, in merge_reloc_roots()
2068 struct btrfs_root *reloc_root) in record_reloc_root_in_trans() argument
2070 struct btrfs_fs_info *fs_info = reloc_root->fs_info; in record_reloc_root_in_trans()
2074 if (reloc_root->last_trans == trans->transid) in record_reloc_root_in_trans()
2077 root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, false); in record_reloc_root_in_trans()
2091 if (root->reloc_root != reloc_root) { in record_reloc_root_in_trans()
2095 reloc_root->root_key.offset); in record_reloc_root_in_trans()
2159 root = root->reloc_root; in select_reloc_root()
2683 if (!root->reloc_root) { in relocate_tree_block()
2687 root = root->reloc_root; in relocate_tree_block()
4130 struct btrfs_root *reloc_root; in btrfs_recover_relocation() local
4167 reloc_root = btrfs_read_tree_root(root, &key); in btrfs_recover_relocation()
4168 if (IS_ERR(reloc_root)) { in btrfs_recover_relocation()
4169 err = PTR_ERR(reloc_root); in btrfs_recover_relocation()
4173 set_bit(BTRFS_ROOT_SHAREABLE, &reloc_root->state); in btrfs_recover_relocation()
4174 list_add(&reloc_root->root_list, &reloc_roots); in btrfs_recover_relocation()
4176 if (btrfs_root_refs(&reloc_root->root_item) > 0) { in btrfs_recover_relocation()
4178 reloc_root->root_key.offset, false); in btrfs_recover_relocation()
4185 ret = mark_garbage_root(reloc_root); in btrfs_recover_relocation()
4230 reloc_root = list_entry(reloc_roots.next, in btrfs_recover_relocation()
4232 list_del(&reloc_root->root_list); in btrfs_recover_relocation()
4234 if (btrfs_root_refs(&reloc_root->root_item) == 0) { in btrfs_recover_relocation()
4235 list_add_tail(&reloc_root->root_list, in btrfs_recover_relocation()
4240 fs_root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, in btrfs_recover_relocation()
4244 list_add_tail(&reloc_root->root_list, &reloc_roots); in btrfs_recover_relocation()
4249 err = __add_reloc_root(reloc_root); in btrfs_recover_relocation()
4252 list_add_tail(&reloc_root->root_list, &reloc_roots); in btrfs_recover_relocation()
4257 fs_root->reloc_root = btrfs_grab_root(reloc_root); in btrfs_recover_relocation()
4419 root = root->reloc_root; in btrfs_reloc_pre_snapshot()
4446 struct btrfs_root *reloc_root; in btrfs_reloc_post_snapshot() local
4466 reloc_root = create_reloc_root(trans, root->reloc_root, in btrfs_reloc_post_snapshot()
4468 if (IS_ERR(reloc_root)) in btrfs_reloc_post_snapshot()
4469 return PTR_ERR(reloc_root); in btrfs_reloc_post_snapshot()
4471 ret = __add_reloc_root(reloc_root); in btrfs_reloc_post_snapshot()
4475 btrfs_put_root(reloc_root); in btrfs_reloc_post_snapshot()
4478 new_root->reloc_root = btrfs_grab_root(reloc_root); in btrfs_reloc_post_snapshot()
4481 ret = clone_backref_node(trans, rc, root, reloc_root); in btrfs_reloc_post_snapshot()