From 333c574d054f95912beef4f020f4128868463fd4 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Tue, 12 Jul 2011 19:56:33 +0800 Subject: VMDK: flush multiple extents Flush all the file that referenced by the image. Signed-off-by: Fam Zheng Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- block/vmdk.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'block') diff --git a/block/vmdk.c b/block/vmdk.c index 529ae90fdb..f6d298635c 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; } -- cgit v1.2.3