Patchwork [08/12] qemu-img: conditionally zero out target on convert

login
register
mail settings
Submitter Paolo Bonzini
Date Sept. 13, 2013, 11:35 a.m.
Message ID <5232F86B.2020201@redhat.com>
Download mbox | patch
Permalink /patch/274730/
State New
Headers show

Comments

Paolo Bonzini - Sept. 13, 2013, 11:35 a.m.
Il 13/09/2013 12:46, Peter Lieven ha scritto:
>>>
>>>   -    flags = BDRV_O_RDWR;
>>> +    flags = BDRV_O_RDWR | BDRV_O_UNMAP;
>> I think this should be a new command-line flag.
> In an earlier version there where no objections. I think it would
> make the usage of qemu-img convert more complicated. For
> most targets has_zero_init is 1 anyway.

If Kevin is okay with having BDRV_O_UNMAP as the default that's fine.
However there should be an option to disable it.  Perhaps it could be
"-S 0" with something like this added:



Paolo

Patch

diff --git a/qemu-img.c b/qemu-img.c
index 3e5e388..f42c90c 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -769,6 +769,10 @@ 
     int ret;
     int num_checked, num_used;

+    if (!min) {
+        return 1;
+    }
+
     if (n < min) {
         min = n;
     }