|
@@ -5440,7 +5440,17 @@ static int update_block_group(struct btrfs_root *root,
|
|
|
spin_unlock(&cache->space_info->lock);
|
|
|
} else {
|
|
|
old_val -= num_bytes;
|
|
|
+ btrfs_set_block_group_used(&cache->item, old_val);
|
|
|
+ cache->pinned += num_bytes;
|
|
|
+ cache->space_info->bytes_pinned += num_bytes;
|
|
|
+ cache->space_info->bytes_used -= num_bytes;
|
|
|
+ cache->space_info->disk_used -= num_bytes * factor;
|
|
|
+ spin_unlock(&cache->lock);
|
|
|
+ spin_unlock(&cache->space_info->lock);
|
|
|
|
|
|
+ set_extent_dirty(info->pinned_extents,
|
|
|
+ bytenr, bytenr + num_bytes - 1,
|
|
|
+ GFP_NOFS | __GFP_NOFAIL);
|
|
|
/*
|
|
|
* No longer have used bytes in this block group, queue
|
|
|
* it for deletion.
|
|
@@ -5454,17 +5464,6 @@ static int update_block_group(struct btrfs_root *root,
|
|
|
}
|
|
|
spin_unlock(&info->unused_bgs_lock);
|
|
|
}
|
|
|
- btrfs_set_block_group_used(&cache->item, old_val);
|
|
|
- cache->pinned += num_bytes;
|
|
|
- cache->space_info->bytes_pinned += num_bytes;
|
|
|
- cache->space_info->bytes_used -= num_bytes;
|
|
|
- cache->space_info->disk_used -= num_bytes * factor;
|
|
|
- spin_unlock(&cache->lock);
|
|
|
- spin_unlock(&cache->space_info->lock);
|
|
|
-
|
|
|
- set_extent_dirty(info->pinned_extents,
|
|
|
- bytenr, bytenr + num_bytes - 1,
|
|
|
- GFP_NOFS | __GFP_NOFAIL);
|
|
|
}
|
|
|
btrfs_put_block_group(cache);
|
|
|
total -= num_bytes;
|