Re: [PATCH v3 3/3] btrfs: Introduce new incompat feature, BG_TREE, to speed up mount time

Anand Jain
2019-10-14T09:09:34Z

> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 044981cf6df9..1c5728e6a660 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -1570,6 +1570,8 @@ struct btrfs_root *btrfs_get_fs_root(struct btrfs_fs_info *fs_info,
> if (location->objectid == BTRFS_FREE_SPACE_TREE_OBJECTID)
> return fs_info->free_space_root ? fs_info->free_space_root :
> ERR_PTR(-ENOENT);
> + if (location->objectid == BTRFS_BLOCK_GROUP_TREE_OBJECTID)

> + return fs_info->bg_root ? fs_info->bg_root: ERR_PTR(-ENOENT);

An explicit check is better than implicit check for example:
------------
return btrfs_fs_incompat(fs_info, BG_TREE) ? \
fs_info->bg_root : ERR_PTR(-ENOENT);
------------

Thanks, Anand