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