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;