mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-24 07:02:45 +00:00
btrfs-progs: mkfs: fix allocation information output of block group types
When cleanup_temp_chunks() removes block groups, it forgot to update mkfs_allocation accordingly, fix this. Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com> [ minor adjustments ] Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
52fda816e8
commit
bf5f9c72af
17
mkfs.c
17
mkfs.c
@ -1318,10 +1318,27 @@ static int cleanup_temp_chunks(struct btrfs_fs_info *fs_info,
|
||||
if (is_temp_block_group(path->nodes[0], bgi,
|
||||
data_profile, meta_profile,
|
||||
sys_profile)) {
|
||||
u64 flags = btrfs_disk_block_group_flags(path->nodes[0],
|
||||
bgi);
|
||||
|
||||
ret = btrfs_free_block_group(trans, fs_info,
|
||||
found_key.objectid, found_key.offset);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
if ((flags & BTRFS_BLOCK_GROUP_TYPE_MASK) ==
|
||||
BTRFS_BLOCK_GROUP_DATA)
|
||||
alloc->data -= found_key.offset;
|
||||
else if ((flags & BTRFS_BLOCK_GROUP_TYPE_MASK) ==
|
||||
BTRFS_BLOCK_GROUP_METADATA)
|
||||
alloc->metadata -= found_key.offset;
|
||||
else if ((flags & BTRFS_BLOCK_GROUP_TYPE_MASK) ==
|
||||
BTRFS_BLOCK_GROUP_SYSTEM)
|
||||
alloc->system -= found_key.offset;
|
||||
else if ((flags & BTRFS_BLOCK_GROUP_TYPE_MASK) ==
|
||||
(BTRFS_BLOCK_GROUP_METADATA |
|
||||
BTRFS_BLOCK_GROUP_DATA))
|
||||
alloc->mixed -= found_key.offset;
|
||||
}
|
||||
btrfs_release_path(path);
|
||||
key.objectid = found_key.objectid + found_key.offset;
|
||||
|
Loading…
Reference in New Issue
Block a user