Lines Matching refs:reloc_root
316 if (!root->reloc_root) in have_reloc_root()
323 struct btrfs_root *reloc_root; in btrfs_should_ignore_reloc_root() local
332 reloc_root = root->reloc_root; in btrfs_should_ignore_reloc_root()
333 if (!reloc_root) in btrfs_should_ignore_reloc_root()
336 if (btrfs_header_generation(reloc_root->commit_root) == in btrfs_should_ignore_reloc_root()
541 struct btrfs_root *reloc_root = src->reloc_root; in clone_backref_node() local
558 BUG_ON(node->new_bytenr != reloc_root->node->start); in clone_backref_node()
563 reloc_root->commit_root->start); in clone_backref_node()
734 struct btrfs_root *reloc_root; in create_reloc_root() local
810 reloc_root = btrfs_read_tree_root(fs_info->tree_root, &root_key); in create_reloc_root()
811 if (IS_ERR(reloc_root)) { in create_reloc_root()
812 ret = PTR_ERR(reloc_root); in create_reloc_root()
815 set_bit(BTRFS_ROOT_SHAREABLE, &reloc_root->state); in create_reloc_root()
816 reloc_root->last_trans = trans->transid; in create_reloc_root()
817 return reloc_root; in create_reloc_root()
837 struct btrfs_root *reloc_root; in btrfs_init_reloc_root() local
861 if (root->reloc_root) { in btrfs_init_reloc_root()
862 reloc_root = root->reloc_root; in btrfs_init_reloc_root()
863 reloc_root->last_trans = trans->transid; in btrfs_init_reloc_root()
880 reloc_root = create_reloc_root(trans, root, root->root_key.objectid); in btrfs_init_reloc_root()
883 if (IS_ERR(reloc_root)) in btrfs_init_reloc_root()
884 return PTR_ERR(reloc_root); in btrfs_init_reloc_root()
886 ret = __add_reloc_root(reloc_root); in btrfs_init_reloc_root()
890 btrfs_put_root(reloc_root); in btrfs_init_reloc_root()
893 root->reloc_root = btrfs_grab_root(reloc_root); in btrfs_init_reloc_root()
904 struct btrfs_root *reloc_root; in btrfs_update_reloc_root() local
911 reloc_root = root->reloc_root; in btrfs_update_reloc_root()
912 root_item = &reloc_root->root_item; in btrfs_update_reloc_root()
919 btrfs_grab_root(reloc_root); in btrfs_update_reloc_root()
930 __del_reloc_root(reloc_root); in btrfs_update_reloc_root()
933 if (reloc_root->commit_root != reloc_root->node) { in btrfs_update_reloc_root()
934 __update_reloc_root(reloc_root); in btrfs_update_reloc_root()
935 btrfs_set_root_node(root_item, reloc_root->node); in btrfs_update_reloc_root()
936 free_extent_buffer(reloc_root->commit_root); in btrfs_update_reloc_root()
937 reloc_root->commit_root = btrfs_root_node(reloc_root); in btrfs_update_reloc_root()
941 &reloc_root->root_key, root_item); in btrfs_update_reloc_root()
942 btrfs_put_root(reloc_root); in btrfs_update_reloc_root()
1597 struct btrfs_root *reloc_root = root->reloc_root; in insert_dirty_subvol() local
1603 ASSERT(reloc_root); in insert_dirty_subvol()
1605 reloc_root_item = &reloc_root->root_item; in insert_dirty_subvol()
1633 struct btrfs_root *reloc_root = root->reloc_root; in clean_dirty_subvols() local
1636 root->reloc_root = NULL; in clean_dirty_subvols()
1643 if (reloc_root) { in clean_dirty_subvols()
1649 ret2 = btrfs_drop_snapshot(reloc_root, 0, 1); in clean_dirty_subvols()
1651 btrfs_put_root(reloc_root); in clean_dirty_subvols()
1681 struct btrfs_root *reloc_root; in merge_reloc_root() local
1697 reloc_root = root->reloc_root; in merge_reloc_root()
1698 root_item = &reloc_root->root_item; in merge_reloc_root()
1702 atomic_inc(&reloc_root->node->refs); in merge_reloc_root()
1703 path->nodes[level] = reloc_root->node; in merge_reloc_root()
1711 ret = btrfs_search_slot(NULL, reloc_root, &key, path, 0, 0); in merge_reloc_root()
1759 reloc_root->last_trans = trans->transid; in merge_reloc_root()
1765 ret = walk_down_reloc_tree(reloc_root, path, &level); in merge_reloc_root()
1775 ret = replace_path(trans, rc, root, reloc_root, path, in merge_reloc_root()
1787 ret = walk_up_reloc_tree(reloc_root, path, &level); in merge_reloc_root()
1843 struct btrfs_root *reloc_root; in prepare_to_merge() local
1883 reloc_root = list_entry(rc->reloc_roots.next, in prepare_to_merge()
1885 list_del_init(&reloc_root->root_list); in prepare_to_merge()
1887 root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, in prepare_to_merge()
1894 list_add(&reloc_root->root_list, &reloc_roots); in prepare_to_merge()
1900 ASSERT(root->reloc_root == reloc_root); in prepare_to_merge()
1907 btrfs_set_root_refs(&reloc_root->root_item, 1); in prepare_to_merge()
1914 list_add(&reloc_root->root_list, &reloc_roots); in prepare_to_merge()
1937 struct btrfs_root *reloc_root, *tmp; in free_reloc_roots() local
1939 list_for_each_entry_safe(reloc_root, tmp, list, root_list) in free_reloc_roots()
1940 __del_reloc_root(reloc_root); in free_reloc_roots()
1948 struct btrfs_root *reloc_root; in merge_reloc_roots() local
1967 reloc_root = list_entry(reloc_roots.next, in merge_reloc_roots()
1970 root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, in merge_reloc_roots()
1972 if (btrfs_root_refs(&reloc_root->root_item) > 0) { in merge_reloc_roots()
1986 if (root->reloc_root != reloc_root) { in merge_reloc_roots()
1999 if (list_empty(&reloc_root->root_list)) in merge_reloc_roots()
2000 list_add_tail(&reloc_root->root_list, in merge_reloc_roots()
2006 if (root->reloc_root == reloc_root) { in merge_reloc_roots()
2007 root->reloc_root = NULL; in merge_reloc_roots()
2008 btrfs_put_root(reloc_root); in merge_reloc_roots()
2015 list_del_init(&reloc_root->root_list); in merge_reloc_roots()
2017 list_add_tail(&reloc_root->reloc_dirty_list, in merge_reloc_roots()
2067 struct btrfs_root *reloc_root) in record_reloc_root_in_trans() argument
2069 struct btrfs_fs_info *fs_info = reloc_root->fs_info; in record_reloc_root_in_trans()
2073 if (reloc_root->last_trans == trans->transid) in record_reloc_root_in_trans()
2076 root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, false); in record_reloc_root_in_trans()
2090 if (root->reloc_root != reloc_root) { in record_reloc_root_in_trans()
2094 reloc_root->root_key.offset); in record_reloc_root_in_trans()
2158 root = root->reloc_root; in select_reloc_root()
2682 if (!root->reloc_root) { in relocate_tree_block()
2686 root = root->reloc_root; in relocate_tree_block()
4154 struct btrfs_root *reloc_root; in btrfs_recover_relocation() local
4191 reloc_root = btrfs_read_tree_root(root, &key); in btrfs_recover_relocation()
4192 if (IS_ERR(reloc_root)) { in btrfs_recover_relocation()
4193 err = PTR_ERR(reloc_root); in btrfs_recover_relocation()
4197 set_bit(BTRFS_ROOT_SHAREABLE, &reloc_root->state); in btrfs_recover_relocation()
4198 list_add(&reloc_root->root_list, &reloc_roots); in btrfs_recover_relocation()
4200 if (btrfs_root_refs(&reloc_root->root_item) > 0) { in btrfs_recover_relocation()
4202 reloc_root->root_key.offset, false); in btrfs_recover_relocation()
4209 ret = mark_garbage_root(reloc_root); in btrfs_recover_relocation()
4254 reloc_root = list_entry(reloc_roots.next, in btrfs_recover_relocation()
4256 list_del(&reloc_root->root_list); in btrfs_recover_relocation()
4258 if (btrfs_root_refs(&reloc_root->root_item) == 0) { in btrfs_recover_relocation()
4259 list_add_tail(&reloc_root->root_list, in btrfs_recover_relocation()
4264 fs_root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, in btrfs_recover_relocation()
4268 list_add_tail(&reloc_root->root_list, &reloc_roots); in btrfs_recover_relocation()
4273 err = __add_reloc_root(reloc_root); in btrfs_recover_relocation()
4276 list_add_tail(&reloc_root->root_list, &reloc_roots); in btrfs_recover_relocation()
4281 fs_root->reloc_root = btrfs_grab_root(reloc_root); in btrfs_recover_relocation()
4444 root = root->reloc_root; in btrfs_reloc_pre_snapshot()
4471 struct btrfs_root *reloc_root; in btrfs_reloc_post_snapshot() local
4491 reloc_root = create_reloc_root(trans, root->reloc_root, in btrfs_reloc_post_snapshot()
4493 if (IS_ERR(reloc_root)) in btrfs_reloc_post_snapshot()
4494 return PTR_ERR(reloc_root); in btrfs_reloc_post_snapshot()
4496 ret = __add_reloc_root(reloc_root); in btrfs_reloc_post_snapshot()
4500 btrfs_put_root(reloc_root); in btrfs_reloc_post_snapshot()
4503 new_root->reloc_root = btrfs_grab_root(reloc_root); in btrfs_reloc_post_snapshot()
4506 ret = clone_backref_node(trans, rc, root, reloc_root); in btrfs_reloc_post_snapshot()