qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] use bdrv_flush to provide barrier semantic in block


From: phoeagon
Subject: [Qemu-devel] [PATCH] use bdrv_flush to provide barrier semantic in block/vdi.c for metadata updates
Date: Fri, 01 May 2015 15:03:29 +0000

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


reply via email to

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