qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] vmdk: Fix format specific information (create type) for streamOptimized
@ 2014-01-23  7:10 Fam Zheng
  2014-01-23 14:42 ` Kevin Wolf
  0 siblings, 1 reply; 3+ messages in thread
From: Fam Zheng @ 2014-01-23  7:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, stefanha

Previously the field is wrong:

    $ ./qemu-img create -f vmdk -o subformat=streamOptimized /tmp/a.vmdk 1G

    $ ./qemu-img info /tmp/a.vmdk
    image: /tmp/a.vmdk
    file format: vmdk
    virtual size: 1.0G (1073741824 bytes)
    disk size: 12K
    Format specific information:
        cid: 1390460459
        parent cid: 4294967295
>>>     create type: monolithicSparse
        <snip>

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

diff --git a/block/vmdk.c b/block/vmdk.c
index c6b60b4..c78fecc 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -654,6 +654,10 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
     }
     extent->compressed =
         le16_to_cpu(header.compressAlgorithm) == VMDK4_COMPRESSION_DEFLATE;
+    if (extent->compressed) {
+        g_free(s->create_type);
+        s->create_type = g_strdup("streamOptimized");
+    }
     extent->has_marker = le32_to_cpu(header.flags) & VMDK4_FLAG_MARKER;
     extent->version = le32_to_cpu(header.version);
     extent->has_zero_grain = le32_to_cpu(header.flags) & VMDK4_FLAG_ZERO_GRAIN;
-- 
1.8.5.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] vmdk: Fix format specific information (create type) for streamOptimized
  2014-01-23  7:10 [Qemu-devel] [PATCH] vmdk: Fix format specific information (create type) for streamOptimized Fam Zheng
@ 2014-01-23 14:42 ` Kevin Wolf
  2014-01-24  7:51   ` Fam Zheng
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Wolf @ 2014-01-23 14:42 UTC (permalink / raw)
  To: Fam Zheng; +Cc: qemu-devel, stefanha

Am 23.01.2014 um 08:10 hat Fam Zheng geschrieben:
> Previously the field is wrong:
> 
>     $ ./qemu-img create -f vmdk -o subformat=streamOptimized /tmp/a.vmdk 1G
> 
>     $ ./qemu-img info /tmp/a.vmdk
>     image: /tmp/a.vmdk
>     file format: vmdk
>     virtual size: 1.0G (1073741824 bytes)
>     disk size: 12K
>     Format specific information:
>         cid: 1390460459
>         parent cid: 4294967295
> >>>     create type: monolithicSparse
>         <snip>
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>

Thanks, applied to the block branch.

By the way, I tried converting a raw image to streamOptimised and got
this:

qemu-img: Could not write to allocated cluster for streamOptimized
qemu-img: error while writing sector 63: Input/output error

The problem seems to be that qemu-img tries to be clever and doesn't
write out sparse parts, which breaks up the first cluster into multiple
write requests. Adding -S 64 makes it work. Should we change something
to get a working default?

Kevin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] vmdk: Fix format specific information (create type) for streamOptimized
  2014-01-23 14:42 ` Kevin Wolf
@ 2014-01-24  7:51   ` Fam Zheng
  0 siblings, 0 replies; 3+ messages in thread
From: Fam Zheng @ 2014-01-24  7:51 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel, stefanha

On Thu, 01/23 15:42, Kevin Wolf wrote:
> Am 23.01.2014 um 08:10 hat Fam Zheng geschrieben:
> > Previously the field is wrong:
> > 
> >     $ ./qemu-img create -f vmdk -o subformat=streamOptimized /tmp/a.vmdk 1G
> > 
> >     $ ./qemu-img info /tmp/a.vmdk
> >     image: /tmp/a.vmdk
> >     file format: vmdk
> >     virtual size: 1.0G (1073741824 bytes)
> >     disk size: 12K
> >     Format specific information:
> >         cid: 1390460459
> >         parent cid: 4294967295
> > >>>     create type: monolithicSparse
> >         <snip>
> > 
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> 
> Thanks, applied to the block branch.
> 
> By the way, I tried converting a raw image to streamOptimised and got
> this:
> 
> qemu-img: Could not write to allocated cluster for streamOptimized
> qemu-img: error while writing sector 63: Input/output error
> 
> The problem seems to be that qemu-img tries to be clever and doesn't
> write out sparse parts, which breaks up the first cluster into multiple
> write requests. Adding -S 64 makes it work. Should we change something
> to get a working default?
> 

I think we should make qemu-img even cleverer to not do this with compressed
image like this. It was once in my todo list but I forgot to complete it. I'll
pick it up.

Thanks,

Fam

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-24  7:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-23  7:10 [Qemu-devel] [PATCH] vmdk: Fix format specific information (create type) for streamOptimized Fam Zheng
2014-01-23 14:42 ` Kevin Wolf
2014-01-24  7:51   ` Fam Zheng

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).