qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, gentoo.integer@gmail.com, stefanha@redhat.com
Subject: [Qemu-devel] [PATCH 2/5] vmdk: Implement .bdrv_write_compressed
Date: Wed, 13 Nov 2013 08:53:11 +0800	[thread overview]
Message-ID: <1384303994-26796-3-git-send-email-famz@redhat.com> (raw)
In-Reply-To: <1384303994-26796-1-git-send-email-famz@redhat.com>

Add a wrapper function to support "compressed" path in qemu-img convert.
Only support streamOptimized subformat case for now (num_extents == 1
and extent compression is true).

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/vmdk.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/block/vmdk.c b/block/vmdk.c
index a7ebd0f..f439206 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1417,6 +1417,19 @@ static coroutine_fn int vmdk_co_write(BlockDriverState *bs, int64_t sector_num,
     return ret;
 }
 
+static int vmdk_write_compressed(BlockDriverState *bs,
+                                 int64_t sector_num,
+                                 const uint8_t *buf,
+                                 int nb_sectors)
+{
+    BDRVVmdkState *s = bs->opaque;
+    if (s->num_extents == 1 && s->extents[0].compressed) {
+        return vmdk_write(bs, sector_num, buf, nb_sectors, false, false);
+    } else {
+        return -ENOTSUP;
+    }
+}
+
 static int coroutine_fn vmdk_co_write_zeroes(BlockDriverState *bs,
                                              int64_t sector_num,
                                              int nb_sectors)
@@ -1937,6 +1950,7 @@ static BlockDriver bdrv_vmdk = {
     .bdrv_reopen_prepare          = vmdk_reopen_prepare,
     .bdrv_read                    = vmdk_co_read,
     .bdrv_write                   = vmdk_co_write,
+    .bdrv_write_compressed        = vmdk_write_compressed,
     .bdrv_co_write_zeroes         = vmdk_co_write_zeroes,
     .bdrv_close                   = vmdk_close,
     .bdrv_create                  = vmdk_create,
-- 
1.8.4.2

  parent reply	other threads:[~2013-11-13  0:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-13  0:53 [Qemu-devel] [PATCH 0/5] Fix conversion from ISO to VMDK streamOptimized Fam Zheng
2013-11-13  0:53 ` [Qemu-devel] [PATCH 1/5] qemu-img: Convert by cluster size if target is compressed Fam Zheng
2013-11-13 15:23   ` Jeff Cody
2013-11-14  1:18     ` Fam Zheng
2013-11-14  1:34       ` Jeff Cody
2013-11-14  1:49         ` Fam Zheng
2013-11-13  0:53 ` Fam Zheng [this message]
2013-11-13  0:53 ` [Qemu-devel] [PATCH 3/5] block: Change BlockDriverInfo.cluster_size to 64 bits Fam Zheng
2013-11-13  0:53 ` [Qemu-devel] [PATCH 4/5] vmdk: Implement .bdrv_get_info() Fam Zheng
2013-11-13  0:53 ` [Qemu-devel] [PATCH 5/5] mirror: Check for bdrv_get_info result Fam Zheng
2013-11-13 15:34   ` Jeff Cody
2013-11-14  1:26     ` Fam Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1384303994-26796-3-git-send-email-famz@redhat.com \
    --to=famz@redhat.com \
    --cc=gentoo.integer@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).