qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 06/17] qemu-img: Convert by cluster size if target is


From: Stefan Hajnoczi
Subject: [Qemu-devel] [PULL 06/17] qemu-img: Convert by cluster size if target is compressed
Date: Fri, 9 May 2014 21:03:26 +0200

From: Fam Zheng <address@hidden>

If target block driver forces compression, qemu-img convert needs to
write by cluster size as well as "-c" option.

Particularly, this applies for converting to VMDK streamOptimized
format.

Signed-off-by: Fam Zheng <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
 include/block/block.h | 4 ++++
 qemu-img.c            | 1 +
 2 files changed, 5 insertions(+)

diff --git a/include/block/block.h b/include/block/block.h
index 467fb2b..27d8598 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -34,6 +34,10 @@ typedef struct BlockDriverInfo {
      * opened with BDRV_O_UNMAP flag for this to work.
      */
     bool can_write_zeroes_with_unmap;
+    /*
+     * True if this block driver only supports compressed writes
+     */
+    bool needs_compressed_writes;
 } BlockDriverInfo;
 
 typedef struct BlockFragInfo {
diff --git a/qemu-img.c b/qemu-img.c
index 317bc6c..04ce02a 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1502,6 +1502,7 @@ static int img_convert(int argc, char **argv)
             goto out;
         }
     } else {
+        compress = compress || bdi.needs_compressed_writes;
         cluster_sectors = bdi.cluster_size / BDRV_SECTOR_SIZE;
     }
 
-- 
1.9.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]