Re: [PATCH v3 2/3] btrfs: block-group: Refactor btrfs_read_block_groups()

David Sterba
2019-11-04T19:55:22Z

On Thu, Oct 10, 2019 at 10:39:27AM +0800, Qu Wenruo wrote:
> +static int read_one_block_group(struct btrfs_fs_info *info,
> + struct btrfs_path *path,
> + int need_clear)
> +{
> + struct extent_buffer *leaf = path->nodes[0];
> + struct btrfs_block_group_cache *cache;
> + struct btrfs_space_info *space_info;
> + struct btrfs_key key;
> + int mixed = btrfs_fs_incompat(info, MIXED_GROUPS);
> + int slot = path->slots[0];
> + int ret;
> +
> + btrfs_item_key_to_cpu(leaf, &key, slot);

The first thing done here is the same as in the caller:

> + btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
> + ret = read_one_block_group(info, path, need_clear);

The key can be passed by pointer so it's not on stack and the conversion
can be removed. I left it in the patch, please send a followup. Thanks.