Without proper cache->flags, btrfs space info will be screwed up and
report error at mount time.
And without proper cache->used, commit transaction will report -EEXIST
when running delayed refs.
Please fold this into the original patch "btrfs: block-group: Refactor btrfs_read_block_groups()".
Signed-off-by: Qu Wenruo <wqu@xxxxxxxx>
---
fs/btrfs/block-group.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
index b5eededaa750..c2bd85d29070 100644
--- a/fs/btrfs/block-group.c
+++ b/fs/btrfs/block-group.c
@@ -1713,6 +1713,8 @@ static int read_one_block_group(struct btrfs_fs_info *info,
}
read_extent_buffer(leaf, &bgi, btrfs_item_ptr_offset(leaf, slot),
sizeof(bgi));
+ cache->used = btrfs_stack_block_group_used(&bgi);
+ cache->flags = btrfs_stack_block_group_flags(&bgi);
if (!mixed && ((cache->flags & BTRFS_BLOCK_GROUP_METADATA) &&
(cache->flags & BTRFS_BLOCK_GROUP_DATA))) {
btrfs_err(info,
--
2.23.0