From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:45163) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qe3rU-00073e-Vu for qemu-devel@nongnu.org; Tue, 05 Jul 2011 07:32:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qe3rT-00022Y-5z for qemu-devel@nongnu.org; Tue, 05 Jul 2011 07:32:16 -0400 Received: from mail-iy0-f173.google.com ([209.85.210.173]:32835) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qe3rS-0001zz-SK for qemu-devel@nongnu.org; Tue, 05 Jul 2011 07:32:15 -0400 Received: by mail-iy0-f173.google.com with SMTP id 3so5889555iyb.4 for ; Tue, 05 Jul 2011 04:32:14 -0700 (PDT) From: Fam Zheng Date: Tue, 5 Jul 2011 19:31:12 +0800 Message-Id: <1309865478-32766-7-git-send-email-famcool@gmail.com> In-Reply-To: <1309865478-32766-1-git-send-email-famcool@gmail.com> References: <1309865478-32766-1-git-send-email-famcool@gmail.com> Subject: [Qemu-devel] [PATCH v8 06/12] VMDK: flush multiple extents List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, Fam Zheng , hch@lst.de, stefanha@gmail.com Flush all the file that referenced by the image. Signed-off-by: Fam Zheng --- block/vmdk.c | 12 +++++++++++- 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; }