Re: [PATCH 02/43] btrfs: move fs root init stuff into btrfs_init_fs_root

Nikolay Borisov
2020-01-20T14:29:47Z

On 17.01.20 г. 23:25 ч., Josef Bacik wrote:
> We have a helper for reading fs roots that just reads the fs root off
> the disk and then sets REF_COWS and init's the inheritable flags. Move
> this into btrfs_init_fs_root so we can later get rid of this helper and
> consolidate all of the fs root reading into one helper.
>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

Both of these are called by btrfs_get_fs_root so this constitutes no
functional changes so:

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

> ---
> fs/btrfs/disk-io.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 1dc33e95052b..2d378aafb70b 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -1445,12 +1445,6 @@ struct btrfs_root *btrfs_read_fs_root(struct btrfs_root *tree_root,
> root = btrfs_read_tree_root(tree_root, location);
> if (IS_ERR(root))
> return root;
> -
> - if (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID) {
> - set_bit(BTRFS_ROOT_REF_COWS, &root->state);
> - btrfs_check_and_init_root_item(&root->root_item);
> - }
> -
> return root;
> }
>
> @@ -1474,6 +1468,11 @@ int btrfs_init_fs_root(struct btrfs_root *root)
> }
> root->subv_writers = writers;
>
> + if (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID) {
> + set_bit(BTRFS_ROOT_REF_COWS, &root->state);
> + btrfs_check_and_init_root_item(&root->root_item);
> + }
> +
> btrfs_init_free_ino_ctl(root);
> spin_lock_init(&root->ino_cache_lock);
> init_waitqueue_head(&root->ino_cache_wait);
>