From: Fam Zheng Date: Tue, 12 Jul 2011 11:56:33 +0000 (+0800) Subject: VMDK: flush multiple extents X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=333c574d054f95912beef4f020f4128868463fd4;p=qemu.git 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 --- 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; }