aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorFam Zheng <famcool@gmail.com>2011-07-12 19:56:33 +0800
committerKevin Wolf <kwolf@redhat.com>2011-07-19 15:39:06 +0200
commit333c574d054f95912beef4f020f4128868463fd4 (patch)
tree22b62dd03415f814d9475f40f0e6736e13914dfa /block
parente1da9b2433f78c4de3bac8c2a97173c648d212c0 (diff)
downloadqemu-333c574d054f95912beef4f020f4128868463fd4.zip
qemu-333c574d054f95912beef4f020f4128868463fd4.tar.gz
qemu-333c574d054f95912beef4f020f4128868463fd4.tar.bz2
VMDK: flush multiple extents
Flush all the file that referenced by the image. Signed-off-by: Fam Zheng <famcool@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/vmdk.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/block/vmdk.c b/block/vmdk.c
index 529ae90..f6d2986 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1072,7 +1072,17 @@ static void vmdk_close(BlockDriverState *bs)
static int vmdk_flush(BlockDriverState *bs)
{
- return bdrv_flush(bs->file);
+ int i, ret, err;
+ BDRVVmdkState *s = bs->opaque;
+
+ ret = bdrv_flush(bs->file);
+ for (i = 0; i < s->num_extents; i++) {
+ err = bdrv_flush(s->extents[i].file);
+ if (err < 0) {
+ ret = err;
+ }
+ }
+ return ret;
}