Lines Matching refs:reloc_root
260 if (!root->reloc_root) in have_reloc_root()
267 struct btrfs_root *reloc_root; in btrfs_should_ignore_reloc_root() local
276 reloc_root = root->reloc_root; in btrfs_should_ignore_reloc_root()
277 if (!reloc_root) in btrfs_should_ignore_reloc_root()
280 if (btrfs_header_generation(reloc_root->commit_root) == in btrfs_should_ignore_reloc_root()
482 struct btrfs_root *reloc_root = src->reloc_root; in clone_backref_node() local
496 BUG_ON(node->new_bytenr != reloc_root->node->start); in clone_backref_node()
501 reloc_root->commit_root->start); in clone_backref_node()
672 struct btrfs_root *reloc_root; in create_reloc_root() local
748 reloc_root = btrfs_read_tree_root(fs_info->tree_root, &root_key); in create_reloc_root()
749 if (IS_ERR(reloc_root)) { in create_reloc_root()
750 ret = PTR_ERR(reloc_root); in create_reloc_root()
753 set_bit(BTRFS_ROOT_SHAREABLE, &reloc_root->state); in create_reloc_root()
754 btrfs_set_root_last_trans(reloc_root, trans->transid); in create_reloc_root()
755 return reloc_root; in create_reloc_root()
775 struct btrfs_root *reloc_root; in btrfs_init_reloc_root() local
799 if (root->reloc_root) { in btrfs_init_reloc_root()
800 reloc_root = root->reloc_root; in btrfs_init_reloc_root()
801 btrfs_set_root_last_trans(reloc_root, trans->transid); in btrfs_init_reloc_root()
817 reloc_root = create_reloc_root(trans, root, btrfs_root_id(root)); in btrfs_init_reloc_root()
820 if (IS_ERR(reloc_root)) in btrfs_init_reloc_root()
821 return PTR_ERR(reloc_root); in btrfs_init_reloc_root()
823 ret = __add_reloc_root(reloc_root); in btrfs_init_reloc_root()
827 btrfs_put_root(reloc_root); in btrfs_init_reloc_root()
830 root->reloc_root = btrfs_grab_root(reloc_root); in btrfs_init_reloc_root()
841 struct btrfs_root *reloc_root; in btrfs_update_reloc_root() local
848 reloc_root = root->reloc_root; in btrfs_update_reloc_root()
849 root_item = &reloc_root->root_item; in btrfs_update_reloc_root()
856 btrfs_grab_root(reloc_root); in btrfs_update_reloc_root()
867 __del_reloc_root(reloc_root); in btrfs_update_reloc_root()
870 if (reloc_root->commit_root != reloc_root->node) { in btrfs_update_reloc_root()
871 __update_reloc_root(reloc_root); in btrfs_update_reloc_root()
872 btrfs_set_root_node(root_item, reloc_root->node); in btrfs_update_reloc_root()
873 free_extent_buffer(reloc_root->commit_root); in btrfs_update_reloc_root()
874 reloc_root->commit_root = btrfs_root_node(reloc_root); in btrfs_update_reloc_root()
878 &reloc_root->root_key, root_item); in btrfs_update_reloc_root()
879 btrfs_put_root(reloc_root); in btrfs_update_reloc_root()
1513 struct btrfs_root *reloc_root = root->reloc_root; in insert_dirty_subvol() local
1519 ASSERT(reloc_root); in insert_dirty_subvol()
1521 reloc_root_item = &reloc_root->root_item; in insert_dirty_subvol()
1549 struct btrfs_root *reloc_root = root->reloc_root; in clean_dirty_subvols() local
1552 root->reloc_root = NULL; in clean_dirty_subvols()
1559 if (reloc_root) { in clean_dirty_subvols()
1565 ret2 = btrfs_drop_snapshot(reloc_root, 0, 1); in clean_dirty_subvols()
1567 btrfs_put_root(reloc_root); in clean_dirty_subvols()
1597 struct btrfs_root *reloc_root; in merge_reloc_root() local
1613 reloc_root = root->reloc_root; in merge_reloc_root()
1614 root_item = &reloc_root->root_item; in merge_reloc_root()
1618 atomic_inc(&reloc_root->node->refs); in merge_reloc_root()
1619 path->nodes[level] = reloc_root->node; in merge_reloc_root()
1627 ret = btrfs_search_slot(NULL, reloc_root, &key, path, 0, 0); in merge_reloc_root()
1676 btrfs_set_root_last_trans(reloc_root, trans->transid); in merge_reloc_root()
1682 ret = walk_down_reloc_tree(reloc_root, path, &level); in merge_reloc_root()
1692 ret = replace_path(trans, rc, root, reloc_root, path, in merge_reloc_root()
1704 ret = walk_up_reloc_tree(reloc_root, path, &level); in merge_reloc_root()
1760 struct btrfs_root *reloc_root; in prepare_to_merge() local
1800 reloc_root = list_entry(rc->reloc_roots.next, in prepare_to_merge()
1802 list_del_init(&reloc_root->root_list); in prepare_to_merge()
1804 root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, in prepare_to_merge()
1811 list_add(&reloc_root->root_list, &reloc_roots); in prepare_to_merge()
1818 if (unlikely(root->reloc_root != reloc_root)) { in prepare_to_merge()
1819 if (root->reloc_root) { in prepare_to_merge()
1823 btrfs_root_id(root->reloc_root), in prepare_to_merge()
1824 root->reloc_root->root_key.type, in prepare_to_merge()
1825 root->reloc_root->root_key.offset, in prepare_to_merge()
1827 &root->reloc_root->root_item), in prepare_to_merge()
1828 btrfs_root_id(reloc_root), in prepare_to_merge()
1829 reloc_root->root_key.type, in prepare_to_merge()
1830 reloc_root->root_key.offset, in prepare_to_merge()
1832 &reloc_root->root_item)); in prepare_to_merge()
1837 btrfs_root_id(reloc_root), in prepare_to_merge()
1838 reloc_root->root_key.type, in prepare_to_merge()
1839 reloc_root->root_key.offset, in prepare_to_merge()
1841 &reloc_root->root_item)); in prepare_to_merge()
1843 list_add(&reloc_root->root_list, &reloc_roots); in prepare_to_merge()
1856 btrfs_set_root_refs(&reloc_root->root_item, 1); in prepare_to_merge()
1863 list_add(&reloc_root->root_list, &reloc_roots); in prepare_to_merge()
1886 struct btrfs_root *reloc_root, *tmp; in free_reloc_roots() local
1888 list_for_each_entry_safe(reloc_root, tmp, list, root_list) in free_reloc_roots()
1889 __del_reloc_root(reloc_root); in free_reloc_roots()
1897 struct btrfs_root *reloc_root; in merge_reloc_roots() local
1916 reloc_root = list_entry(reloc_roots.next, in merge_reloc_roots()
1919 root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, in merge_reloc_roots()
1921 if (btrfs_root_refs(&reloc_root->root_item) > 0) { in merge_reloc_roots()
1934 if (WARN_ON(root->reloc_root != reloc_root)) { in merge_reloc_roots()
1945 if (list_empty(&reloc_root->root_list)) in merge_reloc_roots()
1946 list_add_tail(&reloc_root->root_list, in merge_reloc_roots()
1952 if (root->reloc_root == reloc_root) { in merge_reloc_roots()
1953 root->reloc_root = NULL; in merge_reloc_roots()
1954 btrfs_put_root(reloc_root); in merge_reloc_roots()
1961 list_del_init(&reloc_root->root_list); in merge_reloc_roots()
1963 list_add_tail(&reloc_root->reloc_dirty_list, in merge_reloc_roots()
2013 struct btrfs_root *reloc_root) in record_reloc_root_in_trans() argument
2015 struct btrfs_fs_info *fs_info = reloc_root->fs_info; in record_reloc_root_in_trans()
2019 if (btrfs_get_root_last_trans(reloc_root) == trans->transid) in record_reloc_root_in_trans()
2022 root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, false); in record_reloc_root_in_trans()
2036 if (root->reloc_root != reloc_root) { in record_reloc_root_in_trans()
2040 reloc_root->root_key.offset); in record_reloc_root_in_trans()
2104 root = root->reloc_root; in select_reloc_root()
2634 if (!root->reloc_root) { in relocate_tree_block()
2638 root = root->reloc_root; in relocate_tree_block()
4164 struct btrfs_root *reloc_root; in btrfs_recover_relocation() local
4200 reloc_root = btrfs_read_tree_root(fs_info->tree_root, &key); in btrfs_recover_relocation()
4201 if (IS_ERR(reloc_root)) { in btrfs_recover_relocation()
4202 ret = PTR_ERR(reloc_root); in btrfs_recover_relocation()
4206 set_bit(BTRFS_ROOT_SHAREABLE, &reloc_root->state); in btrfs_recover_relocation()
4207 list_add(&reloc_root->root_list, &reloc_roots); in btrfs_recover_relocation()
4209 if (btrfs_root_refs(&reloc_root->root_item) > 0) { in btrfs_recover_relocation()
4211 reloc_root->root_key.offset, false); in btrfs_recover_relocation()
4216 ret = mark_garbage_root(reloc_root); in btrfs_recover_relocation()
4258 reloc_root = list_entry(reloc_roots.next, in btrfs_recover_relocation()
4260 list_del(&reloc_root->root_list); in btrfs_recover_relocation()
4262 if (btrfs_root_refs(&reloc_root->root_item) == 0) { in btrfs_recover_relocation()
4263 list_add_tail(&reloc_root->root_list, in btrfs_recover_relocation()
4268 fs_root = btrfs_get_fs_root(fs_info, reloc_root->root_key.offset, in btrfs_recover_relocation()
4272 list_add_tail(&reloc_root->root_list, &reloc_roots); in btrfs_recover_relocation()
4277 ret = __add_reloc_root(reloc_root); in btrfs_recover_relocation()
4280 list_add_tail(&reloc_root->root_list, &reloc_roots); in btrfs_recover_relocation()
4285 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, btrfs_root_id(new_root)); in btrfs_reloc_post_snapshot()
4492 if (IS_ERR(reloc_root)) in btrfs_reloc_post_snapshot()
4493 return PTR_ERR(reloc_root); in btrfs_reloc_post_snapshot()
4495 ret = __add_reloc_root(reloc_root); in btrfs_reloc_post_snapshot()
4499 btrfs_put_root(reloc_root); in btrfs_reloc_post_snapshot()
4502 new_root->reloc_root = btrfs_grab_root(reloc_root); in btrfs_reloc_post_snapshot()
4505 ret = clone_backref_node(trans, rc, root, reloc_root); in btrfs_reloc_post_snapshot()