aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2013-07-05 13:48:01 +0200
committerKevin Wolf <kwolf@redhat.com>2013-07-15 09:51:27 +0200
commitf0f0fdfeec6c67ad374114ecc4b3e3ccde5e94d2 (patch)
tree2781e463bbaa569ac6a26948acef37e78ad1d3f9 /block.c
parent7a370406bdd13b1d46230d1cbca308d984d0dcae (diff)
downloadqemu-f0f0fdfeec6c67ad374114ecc4b3e3ccde5e94d2.zip
qemu-f0f0fdfeec6c67ad374114ecc4b3e3ccde5e94d2.tar.gz
qemu-f0f0fdfeec6c67ad374114ecc4b3e3ccde5e94d2.tar.bz2
block: Add return value for bdrv_flush_all()
bdrv_flush() can fail, and bdrv_flush_all() should return an error as well if this happens for a block device. It returns the first error return now, but still at least tries to flush the remaining devices even in error cases. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/block.c b/block.c
index 2df65c8..b560241 100644
--- a/block.c
+++ b/block.c
@@ -2910,13 +2910,19 @@ int bdrv_get_flags(BlockDriverState *bs)
return bs->open_flags;
}
-void bdrv_flush_all(void)
+int bdrv_flush_all(void)
{
BlockDriverState *bs;
+ int result = 0;
QTAILQ_FOREACH(bs, &bdrv_states, list) {
- bdrv_flush(bs);
+ int ret = bdrv_flush(bs);
+ if (ret < 0 && !result) {
+ result = ret;
+ }
}
+
+ return result;
}
int bdrv_has_zero_init_1(BlockDriverState *bs)