*/
void check_system_chunk(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
- u64 type,
- const bool is_allocation)
+ u64 type)
{
struct btrfs_space_info *info;
u64 left;
num_devs = get_profile_num_devs(root, type);
/* num_devs device items to update and 1 chunk item to add or remove */
- if (is_allocation)
- thresh = btrfs_calc_trans_metadata_size(root, num_devs + 1);
- else
- thresh = btrfs_calc_trans_metadata_size(root, num_devs) +
- btrfs_calc_trunc_metadata_size(root, 1);
+ thresh = btrfs_calc_trunc_metadata_size(root, num_devs) +
+ btrfs_calc_trans_metadata_size(root, 1);
if (left < thresh && btrfs_test_opt(root, ENOSPC_DEBUG)) {
btrfs_info(root->fs_info, "left=%llu, need=%llu, flags=%llu",
* Check if we have enough space in SYSTEM chunk because we may need
* to update devices.
*/
- check_system_chunk(trans, extent_root, flags, true);
+ check_system_chunk(trans, extent_root, flags);
ret = btrfs_alloc_chunk(trans, extent_root, flags);
trans->allocating_chunk = false;
if (cache->flags & BTRFS_BLOCK_GROUP_SYSTEM) {
alloc_flags = update_block_group_flags(root, cache->flags);
lock_chunks(root->fs_info->chunk_root);
- check_system_chunk(trans, root, alloc_flags, true);
+ check_system_chunk(trans, root, alloc_flags);
unlock_chunks(root->fs_info->chunk_root);
}
mutex_unlock(&root->fs_info->ro_block_group_mutex);
}
map = (struct map_lookup *)em->bdev;
lock_chunks(root->fs_info->chunk_root);
- check_system_chunk(trans, extent_root, map->type, false);
+ check_system_chunk(trans, extent_root, map->type);
unlock_chunks(root->fs_info->chunk_root);
for (i = 0; i < map->num_stripes; i++) {