[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 22/23] vmdk: Fix next_cluster_sector for compressed w
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 22/23] vmdk: Fix next_cluster_sector for compressed write |
Date: |
Fri, 11 Sep 2015 21:41:02 +0200 |
From: Radoslav Gerganov <address@hidden>
When the VMDK is streamOptimized (or compressed), the
next_cluster_sector must not be incremented by a fixed number of
sectors. Instead of this, it must be rounded up to the next consecutive
sector. Fixing this results in much smaller compressed images.
Signed-off-by: Radoslav Gerganov <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/vmdk.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index 7bdc3d0..be0d640 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1324,8 +1324,12 @@ static int vmdk_write_extent(VmdkExtent *extent, int64_t
cluster_offset,
write_end_sector = DIV_ROUND_UP(write_offset + write_len,
BDRV_SECTOR_SIZE);
- extent->next_cluster_sector = MAX(extent->next_cluster_sector,
- write_end_sector);
+ if (extent->compressed) {
+ extent->next_cluster_sector = write_end_sector;
+ } else {
+ extent->next_cluster_sector = MAX(extent->next_cluster_sector,
+ write_end_sector);
+ }
if (ret != write_len) {
ret = ret < 0 ? ret : -EIO;
--
1.8.3.1
- [Qemu-block] [PULL 09/23] qemu-io: Add command 'reopen', (continued)
- [Qemu-block] [PULL 09/23] qemu-io: Add command 'reopen', Kevin Wolf, 2015/09/11
- [Qemu-block] [PULL 10/23] qcow2: Improve error message, Kevin Wolf, 2015/09/11
- [Qemu-block] [PULL 06/23] qcow2: Rename BDRVQcowState to BDRVQcow2State, Kevin Wolf, 2015/09/11
- [Qemu-block] [PULL 11/23] qcow2: Factor out qcow2_update_options(), Kevin Wolf, 2015/09/11
- [Qemu-block] [PULL 12/23] qcow2: Move qcow2_update_options() call up, Kevin Wolf, 2015/09/11
- [Qemu-block] [PULL 13/23] qcow2: Move rest of option handling to qcow2_update_options(), Kevin Wolf, 2015/09/11
- [Qemu-block] [PULL 15/23] qcow2: Fix memory leak in qcow2_update_options() error path, Kevin Wolf, 2015/09/11
- [Qemu-block] [PULL 14/23] qcow2: Leave s unchanged on qcow2_update_options() failure, Kevin Wolf, 2015/09/11
- [Qemu-block] [PULL 23/23] qcow2: Make qcow2_alloc_bytes() more explicit, Kevin Wolf, 2015/09/11
- [Qemu-block] [PULL 21/23] iotests: Add test for checking large image files, Kevin Wolf, 2015/09/11
- [Qemu-block] [PULL 22/23] vmdk: Fix next_cluster_sector for compressed write,
Kevin Wolf <=
- [Qemu-block] [PULL 16/23] qcow2: Make qcow2_update_options() suitable for transactions, Kevin Wolf, 2015/09/11
- [Qemu-block] [PULL 18/23] qemu-iotests: Reopen qcow2 with lazy-refcounts change, Kevin Wolf, 2015/09/11
- [Qemu-block] [PULL 17/23] qcow2: Support updating driver-specific options in reopen, Kevin Wolf, 2015/09/11
- [Qemu-block] [PULL 20/23] qcow2: Make size_to_clusters() return uint64_t, Kevin Wolf, 2015/09/11
- [Qemu-block] [PULL 19/23] qemu-iotests: More qcow2 reopen tests, Kevin Wolf, 2015/09/11
- Re: [Qemu-block] [Qemu-devel] [PULL 00/23] Block layer patches, Peter Maydell, 2015/09/14