]> git.hungrycats.org Git - linux/commitdiff
btrfs: make relocation use btrfs_read_tree_root()
authorJosef Bacik <josef@toxicpanda.com>
Wed, 20 Nov 2019 14:37:00 +0000 (06:37 -0800)
committerJosef Bacik <josef@toxicpanda.com>
Fri, 6 Dec 2019 16:34:48 +0000 (08:34 -0800)
Relocation has it's special roots, we don't want to save these in the
root cache either, so swap it to use btrfs_read_tree_roo().  However the
reloc root does need REF_COWS set, so make sure we set it everywhere we
use this helper, as it no longer does the REF_COWS setting.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
fs/btrfs/relocation.c

index c5fcddad1c15009287b93124d8db159374482711..3f11491e01eb66601677c9a06fbf571c174714cc 100644 (file)
@@ -1415,8 +1415,9 @@ static struct btrfs_root *create_reloc_root(struct btrfs_trans_handle *trans,
        BUG_ON(ret);
        kfree(root_item);
 
-       reloc_root = btrfs_read_fs_root(fs_info->tree_root, &root_key);
+       reloc_root = btrfs_read_tree_root(fs_info->tree_root, &root_key);
        BUG_ON(IS_ERR(reloc_root));
+       set_bit(BTRFS_ROOT_REF_COWS, &reloc_root->state);
        reloc_root->last_trans = trans->transid;
        return reloc_root;
 }
@@ -4486,12 +4487,13 @@ int btrfs_recover_relocation(struct btrfs_root *root)
                    key.type != BTRFS_ROOT_ITEM_KEY)
                        break;
 
-               reloc_root = btrfs_read_fs_root(root, &key);
+               reloc_root = btrfs_read_tree_root(root, &key);
                if (IS_ERR(reloc_root)) {
                        err = PTR_ERR(reloc_root);
                        goto out;
                }
 
+               set_bit(BTRFS_ROOT_REF_COWS, &reloc_root->state);
                list_add(&reloc_root->root_list, &reloc_roots);
 
                if (btrfs_root_refs(&reloc_root->root_item) > 0) {