On 10/8/19 12:49 PM, Qu Wenruo wrote:
Refactor the work inside the loop of btrfs_read_block_groups() into one
separate function, read_one_block_group().
This allows read_one_block_group to be reused for later BG_TREE feature.
Signed-off-by: Qu Wenruo <wqu@xxxxxxxx>
Nit: Change log didn't mention about things which is also fixed here.
1. The incompatible feature check cleanups.
+ int mixed = btrfs_fs_incompat(info, MIXED_GROUPS);
2. The bug we failed to call "btrfs_put_block_group(cache);" at [1]
-----------------
- if (!mixed &&
- ((cache->flags & BTRFS_BLOCK_GROUP_METADATA) &&
- (cache->flags & BTRFS_BLOCK_GROUP_DATA))) {
- btrfs_err(info,
-"bg %llu is a mixed block group but filesystem hasn't enabled mixed
block groups",
- cache->key.objectid);
- ret = -EINVAL; <---- [1]
+ btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
+ ret = read_one_block_group(info, path, need_clear);
+ if (ret < 0)
goto error;
- }
-----------------
Otherwise looks good.
Reviewed-by: Anand Jain <anand.jain@xxxxxxxxxx>
Thanks, Anand