|
|
958e1b |
From e865b795a4b0eaae50745ad7dd694447c72600c9 Mon Sep 17 00:00:00 2001
|
|
|
958e1b |
Message-Id: <e865b795a4b0eaae50745ad7dd694447c72600c9.1418766606.git.jen@redhat.com>
|
|
|
958e1b |
In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com>
|
|
|
958e1b |
References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com>
|
|
|
958e1b |
From: Fam Zheng <famz@redhat.com>
|
|
|
958e1b |
Date: Thu, 4 Dec 2014 00:05:13 -0600
|
|
|
958e1b |
Subject: [CHANGE 19/31] vmdk: Implement .bdrv_write_compressed
|
|
|
958e1b |
To: rhvirt-patches@redhat.com,
|
|
|
958e1b |
jen@redhat.com
|
|
|
958e1b |
|
|
|
958e1b |
RH-Author: Fam Zheng <famz@redhat.com>
|
|
|
958e1b |
Message-id: <1417651524-18041-20-git-send-email-famz@redhat.com>
|
|
|
958e1b |
Patchwork-id: 62692
|
|
|
958e1b |
O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 19/30] vmdk: Implement .bdrv_write_compressed
|
|
|
958e1b |
Bugzilla: 1134283
|
|
|
958e1b |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
958e1b |
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
|
|
958e1b |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
958e1b |
|
|
|
958e1b |
Add a wrapper function to support "compressed" path in qemu-img convert.
|
|
|
958e1b |
Only support streamOptimized subformat case for now (num_extents == 1
|
|
|
958e1b |
and extent compression is true).
|
|
|
958e1b |
|
|
|
958e1b |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
958e1b |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
958e1b |
(cherry picked from commit ba0ad89e2c3316ce26ca6576a3c5051f91bfc0fe)
|
|
|
958e1b |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
958e1b |
Signed-off-by: Jeff E. Nelson <jen@redhat.com>
|
|
|
958e1b |
---
|
|
|
958e1b |
block/vmdk.c | 14 ++++++++++++++
|
|
|
958e1b |
1 file changed, 14 insertions(+)
|
|
|
958e1b |
|
|
|
958e1b |
diff --git a/block/vmdk.c b/block/vmdk.c
|
|
|
958e1b |
index 4cd2795..157db7e 100644
|
|
|
958e1b |
--- a/block/vmdk.c
|
|
|
958e1b |
+++ b/block/vmdk.c
|
|
|
958e1b |
@@ -1495,6 +1495,19 @@ static coroutine_fn int vmdk_co_write(BlockDriverState *bs, int64_t sector_num,
|
|
|
958e1b |
return ret;
|
|
|
958e1b |
}
|
|
|
958e1b |
|
|
|
958e1b |
+static int vmdk_write_compressed(BlockDriverState *bs,
|
|
|
958e1b |
+ int64_t sector_num,
|
|
|
958e1b |
+ const uint8_t *buf,
|
|
|
958e1b |
+ int nb_sectors)
|
|
|
958e1b |
+{
|
|
|
958e1b |
+ BDRVVmdkState *s = bs->opaque;
|
|
|
958e1b |
+ if (s->num_extents == 1 && s->extents[0].compressed) {
|
|
|
958e1b |
+ return vmdk_write(bs, sector_num, buf, nb_sectors, false, false);
|
|
|
958e1b |
+ } else {
|
|
|
958e1b |
+ return -ENOTSUP;
|
|
|
958e1b |
+ }
|
|
|
958e1b |
+}
|
|
|
958e1b |
+
|
|
|
958e1b |
static int coroutine_fn vmdk_co_write_zeroes(BlockDriverState *bs,
|
|
|
958e1b |
int64_t sector_num,
|
|
|
958e1b |
int nb_sectors,
|
|
|
958e1b |
@@ -2104,6 +2117,7 @@ static BlockDriver bdrv_vmdk = {
|
|
|
958e1b |
.bdrv_reopen_prepare = vmdk_reopen_prepare,
|
|
|
958e1b |
.bdrv_read = vmdk_co_read,
|
|
|
958e1b |
.bdrv_write = vmdk_co_write,
|
|
|
958e1b |
+ .bdrv_write_compressed = vmdk_write_compressed,
|
|
|
958e1b |
.bdrv_co_write_zeroes = vmdk_co_write_zeroes,
|
|
|
958e1b |
.bdrv_close = vmdk_close,
|
|
|
958e1b |
.bdrv_create = vmdk_create,
|
|
|
958e1b |
--
|
|
|
958e1b |
2.1.0
|
|
|
958e1b |
|