qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] use bdrv_flush to provide barrier semantic in block/vdi.c for metadata updates
@ 2015-05-01 15:03 phoeagon
  2015-05-06 16:42 ` Max Reitz
  0 siblings, 1 reply; 5+ messages in thread
From: phoeagon @ 2015-05-01 15:03 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1282 bytes --]

Looks like VDI is the only writable image format that does not use
write-with-barrier(sync) when updating the metadata. A sequence of commits
b0ad5a455d~078a458e077d6b0db2 fixes this for QCOW/COW/QCOW2/VPC/VMDK, but
the VDI does not issue a barrier by sync after updating the metadata.

This commit adds a `bdrv_flush` after updating block map.


Signed-off-by: Zhe Qiu <address@hidden>
---------------
>From 2ea36d9a0e676b534483dc54c191f421f9889dc6 Mon Sep 17 00:00:00 2001
From: phoeagon <address@hidden>
Date: Fri, 1 May 2015 19:00:22 +0800
Subject: [PATCH] use bdrv_flush to provide barrier semantic in block/vdi.c

In reference to
b0ad5a455d7e5352d4c86ba945112011dbeadfb8~078a458e077d6b0db262c4b05fee51d01de2d1d2,
metadata writes to qcow2/cow/qcow/vpc/vmdk are all synced prior to
succeeding writes.
---
 block/vdi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/vdi.c b/block/vdi.c
index 7642ef3..5d09b36 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -713,6 +713,7 @@ static int vdi_co_write(BlockDriverState *bs,
         logout("will write %u block map sectors starting from entry %u\n",
                n_sectors, bmap_first);
         ret = bdrv_write(bs->file, offset, base, n_sectors);
+        ret = bdrv_flush(bs->file);
     }

     return ret;
-- 
2.3.7

[-- Attachment #2: Type: text/html, Size: 1912 bytes --]

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

end of thread, other threads:[~2015-05-06 17:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-01 15:03 [Qemu-devel] [PATCH] use bdrv_flush to provide barrier semantic in block/vdi.c for metadata updates phoeagon
2015-05-06 16:42 ` Max Reitz
2015-05-06 17:23   ` phoeagon
2015-05-06 17:28     ` Eric Blake
2015-05-06 17:36     ` Max Reitz

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