aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2011-11-10 18:10:11 +0100
committerKevin Wolf <kwolf@redhat.com>2011-11-11 14:02:59 +0100
commiteb489bb1eceea0d710cd5f5122d37213300ceef6 (patch)
treea4f6ea0374bdd83c83ebe7391c56211c7190ed71 /block.c
parentc68b89acd636ff545bc7cb92739c41999291ce3c (diff)
downloadqemu-eb489bb1eceea0d710cd5f5122d37213300ceef6.zip
qemu-eb489bb1eceea0d710cd5f5122d37213300ceef6.tar.gz
qemu-eb489bb1eceea0d710cd5f5122d37213300ceef6.tar.bz2
block: Introduce bdrv_co_flush_to_os
qcow2 has a writeback metadata cache, so flushing a qcow2 image actually consists of writing back that cache to the protocol and only then flushes the protocol in order to get everything stable on disk. This introduces a separate bdrv_co_flush_to_os to reflect the split. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/block.c b/block.c
index 6521eaa..b1a4629 100644
--- a/block.c
+++ b/block.c
@@ -2789,11 +2789,22 @@ static void coroutine_fn bdrv_flush_co_entry(void *opaque)
int coroutine_fn bdrv_co_flush(BlockDriverState *bs)
{
+ int ret;
+
if (bs->open_flags & BDRV_O_NO_FLUSH) {
return 0;
} else if (!bs->drv) {
return 0;
- } else if (bs->drv->bdrv_co_flush_to_disk) {
+ }
+
+ if (bs->drv->bdrv_co_flush_to_os) {
+ ret = bs->drv->bdrv_co_flush_to_os(bs);
+ if (ret < 0) {
+ return ret;
+ }
+ }
+
+ if (bs->drv->bdrv_co_flush_to_disk) {
return bs->drv->bdrv_co_flush_to_disk(bs);
} else if (bs->drv->bdrv_aio_flush) {
BlockDriverAIOCB *acb;