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