[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 26/31] qcow2: Update qcow2_truncate() to support L2
From: |
Alberto Garcia |
Subject: |
[Qemu-devel] [PATCH 26/31] qcow2: Update qcow2_truncate() to support L2 slices |
Date: |
Thu, 12 Oct 2017 16:05:40 +0300 |
The qcow2_truncate() code is mostly independent from whether
we're using L2 slices or full L2 tables, but in full and
falloc preallocation modes new L2 tables are allocated using
qcow2_alloc_cluster_link_l2(). Therefore the code needs to be
modified to ensure that all nb_clusters that are processed in each
call can be allocated with just one L2 slice.
Signed-off-by: Alberto Garcia <address@hidden>
---
block/qcow2.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index e5458fcffd..63e88a1d6e 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -3252,8 +3252,9 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t
offset,
guest_offset = old_length;
while (nb_new_data_clusters) {
int64_t guest_cluster = guest_offset >> s->cluster_bits;
- int64_t nb_clusters = MIN(nb_new_data_clusters,
- s->l2_size - guest_cluster % s->l2_size);
+ int64_t nb_clusters = MIN(
+ nb_new_data_clusters,
+ s->l2_slice_size - guest_cluster % s->l2_slice_size);
QCowL2Meta allocation = {
.offset = guest_offset,
.alloc_offset = host_offset,
--
2.11.0
- [Qemu-devel] [PATCH 00/31] Allow configuring the qcow2 L2 cache entry size, Alberto Garcia, 2017/10/12
- [Qemu-devel] [PATCH 28/31] qcow2: Rename l2_table in count_contiguous_clusters(), Alberto Garcia, 2017/10/12
- [Qemu-devel] [PATCH 02/31] qcow2: Add table size field to Qcow2Cache, Alberto Garcia, 2017/10/12
- [Qemu-devel] [PATCH 31/31] qcow2: Allow configuring the L2 slice size, Alberto Garcia, 2017/10/12
- [Qemu-devel] [PATCH 27/31] qcow2: Rename l2_table in qcow2_alloc_compressed_cluster_offset(), Alberto Garcia, 2017/10/12
- [Qemu-devel] [PATCH 30/31] qcow2: Rename l2_table in count_cow_clusters(), Alberto Garcia, 2017/10/12
- [Qemu-devel] [PATCH 26/31] qcow2: Update qcow2_truncate() to support L2 slices,
Alberto Garcia <=
- [Qemu-devel] [PATCH 29/31] qcow2: Rename l2_table in count_contiguous_clusters_unallocated(), Alberto Garcia, 2017/10/12
- [Qemu-devel] [PATCH 25/31] qcow2: Update expand_zero_clusters_in_l1() to support L2 slices, Alberto Garcia, 2017/10/12
- [Qemu-devel] [PATCH 24/31] qcow2: Update qcow2_update_snapshot_refcount() to support L2 slices, Alberto Garcia, 2017/10/12
- [Qemu-devel] [PATCH 23/31] qcow2: Update zero_single_l2() to support L2 slices, Alberto Garcia, 2017/10/12
- [Qemu-devel] [PATCH 22/31] qcow2: Update discard_single_l2() to support L2 slices, Alberto Garcia, 2017/10/12
- [Qemu-devel] [PATCH 21/31] qcow2: Update handle_alloc() to support L2 slices, Alberto Garcia, 2017/10/12
- [Qemu-devel] [PATCH 20/31] qcow2: Update handle_copied() to support L2 slices, Alberto Garcia, 2017/10/12
- [Qemu-devel] [PATCH 19/31] qcow2: Update qcow2_alloc_cluster_link_l2() to support L2 slices, Alberto Garcia, 2017/10/12
- [Qemu-devel] [PATCH 18/31] qcow2: Update qcow2_get_cluster_offset() to support L2 slices, Alberto Garcia, 2017/10/12