]> git.proxmox.com Git - qemu.git/commitdiff
qemu-img: let 'qemu-img convert' flush data
authorLiu Yuan <tailai.ly@taobao.com>
Fri, 20 Apr 2012 09:10:56 +0000 (17:10 +0800)
committerKevin Wolf <kwolf@redhat.com>
Fri, 20 Apr 2012 09:42:41 +0000 (11:42 +0200)
The 'qemu-img convert -h' advertise that the default cache mode is
'writeback', while in fact it is 'unsafe'.

This patch 1) fix the help manual and 2) let bdrv_close() call bdrv_flush()

2) is needed because some backend storage doesn't have a self-flush
mechanism(for e.g., sheepdog), so we need to call bdrv_flush() to make
sure the image is really writen to the storage instead of hanging around
writeback cache forever.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block.c
qemu-img.c

diff --git a/block.c b/block.c
index 4b96654e7d6264a32b393a929c47be3edba2c156..421cd1bebdc3618dc9f777a8d2c9dbcf5fa76faa 100644 (file)
--- a/block.c
+++ b/block.c
@@ -812,6 +812,7 @@ unlink_and_fail:
 
 void bdrv_close(BlockDriverState *bs)
 {
+    bdrv_flush(bs);
     if (bs->drv) {
         if (bs->job) {
             block_job_cancel_sync(bs->job);
index 6a61ca8d06e46c2173da43372a6013f399063b0e..0ae543cade94b5e033b21302e0b0c00e6a5d160c 100644 (file)
@@ -66,8 +66,8 @@ static void help(void)
            "  'filename' is a disk image filename\n"
            "  'fmt' is the disk image format. It is guessed automatically in most cases\n"
            "  'cache' is the cache mode used to write the output disk image, the valid\n"
-           "    options are: 'none', 'writeback' (default), 'writethrough', 'directsync'\n"
-           "    and 'unsafe'\n"
+           "    options are: 'none', 'writeback' (default, except for convert), 'writethrough',\n"
+           "    'directsync' and 'unsafe' (default for convert)\n"
            "  'size' is the disk image size in bytes. Optional suffixes\n"
            "    'k' or 'K' (kilobyte, 1024), 'M' (megabyte, 1024k), 'G' (gigabyte, 1024M)\n"
            "    and T (terabyte, 1024G) are supported. 'b' is ignored.\n"