|
|
34b321 |
From bc048d2d5f362757fa0bf51add81d92ec19ad161 Mon Sep 17 00:00:00 2001
|
|
|
34b321 |
From: Fam Zheng <famz@redhat.com>
|
|
|
34b321 |
Date: Mon, 15 Feb 2016 09:28:28 +0100
|
|
|
34b321 |
Subject: [PATCH 15/18] vmdk: Fix next_cluster_sector for compressed write
|
|
|
34b321 |
|
|
|
34b321 |
RH-Author: Fam Zheng <famz@redhat.com>
|
|
|
34b321 |
Message-id: <1455528511-9357-16-git-send-email-famz@redhat.com>
|
|
|
34b321 |
Patchwork-id: 69181
|
|
|
34b321 |
O-Subject: [RHEL-7.3 qemu-kvm PATCH 15/18] vmdk: Fix next_cluster_sector for compressed write
|
|
|
34b321 |
Bugzilla: 1299250
|
|
|
34b321 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
34b321 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
34b321 |
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
|
|
34b321 |
|
|
|
34b321 |
From: Radoslav Gerganov <rgerganov@vmware.com>
|
|
|
34b321 |
|
|
|
34b321 |
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1299250
|
|
|
34b321 |
|
|
|
34b321 |
When the VMDK is streamOptimized (or compressed), the
|
|
|
34b321 |
next_cluster_sector must not be incremented by a fixed number of
|
|
|
34b321 |
sectors. Instead of this, it must be rounded up to the next consecutive
|
|
|
34b321 |
sector. Fixing this results in much smaller compressed images.
|
|
|
34b321 |
|
|
|
34b321 |
Signed-off-by: Radoslav Gerganov <rgerganov@vmware.com>
|
|
|
34b321 |
Reviewed-by: Fam Zheng <famz@redhat.com>
|
|
|
34b321 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
34b321 |
(cherry picked from commit 3efffc3292d94271a15b1606b4a56adf6c6f04ed)
|
|
|
34b321 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
34b321 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
34b321 |
---
|
|
|
34b321 |
block/vmdk.c | 8 ++++++--
|
|
|
34b321 |
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
|
34b321 |
|
|
|
34b321 |
diff --git a/block/vmdk.c b/block/vmdk.c
|
|
|
34b321 |
index cb5255c..7009660 100644
|
|
|
34b321 |
--- a/block/vmdk.c
|
|
|
34b321 |
+++ b/block/vmdk.c
|
|
|
34b321 |
@@ -1333,8 +1333,12 @@ static int vmdk_write_extent(VmdkExtent *extent, int64_t cluster_offset,
|
|
|
34b321 |
|
|
|
34b321 |
write_end_sector = DIV_ROUND_UP(write_offset + write_len, BDRV_SECTOR_SIZE);
|
|
|
34b321 |
|
|
|
34b321 |
- extent->next_cluster_sector = MAX(extent->next_cluster_sector,
|
|
|
34b321 |
- write_end_sector);
|
|
|
34b321 |
+ if (extent->compressed) {
|
|
|
34b321 |
+ extent->next_cluster_sector = write_end_sector;
|
|
|
34b321 |
+ } else {
|
|
|
34b321 |
+ extent->next_cluster_sector = MAX(extent->next_cluster_sector,
|
|
|
34b321 |
+ write_end_sector);
|
|
|
34b321 |
+ }
|
|
|
34b321 |
|
|
|
34b321 |
if (ret != write_len) {
|
|
|
34b321 |
ret = ret < 0 ? ret : -EIO;
|
|
|
34b321 |
--
|
|
|
34b321 |
1.8.3.1
|
|
|
34b321 |
|