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>
This commit is contained in:
Fam Zheng 2011-07-12 19:56:33 +08:00 committed by Kevin Wolf
parent e1da9b2433
commit 333c574d05

View file

@ -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;
}