From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:45682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXyfI-0003nS-Aj for qemu-devel@nongnu.org; Sat, 18 Jun 2011 12:46:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QXyfF-0007e6-Jk for qemu-devel@nongnu.org; Sat, 18 Jun 2011 12:46:31 -0400 Received: from mail-gw0-f45.google.com ([74.125.83.45]:57379) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXyfF-0007dy-AN for qemu-devel@nongnu.org; Sat, 18 Jun 2011 12:46:29 -0400 Received: by gwb19 with SMTP id 19so254834gwb.4 for ; Sat, 18 Jun 2011 09:46:28 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: Date: Sat, 18 Jun 2011 17:46:28 +0100 Message-ID: From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 07/12] VMDK: vmdk_flush for extents List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Kevin Wolf , qemu-devel@nongnu.org, Christoph Hellwig On Sat, Jun 4, 2011 at 1:42 AM, Fam Zheng wrote: > Vmdk flush in extent array style. > > > Signed-off-by: Fam Zheng > --- > =A0block/vmdk.c | =A0 =A09 ++++++++- > =A01 files changed, 8 insertions(+), 1 deletions(-) > > diff --git a/block/vmdk.c b/block/vmdk.c > index f1233cf..1d74b62 100644 > --- a/block/vmdk.c > +++ b/block/vmdk.c > @@ -1094,7 +1094,14 @@ static void vmdk_close(BlockDriverState *bs) > > =A0static int vmdk_flush(BlockDriverState *bs) > =A0{ > - =A0 =A0return bdrv_flush(bs->file); > + =A0 =A0int i, ret; > + =A0 =A0BDRVVmdkState *s =3D bs->opaque; > + > + =A0 =A0ret =3D bdrv_flush(bs->file); > + =A0 =A0for (i =3D 0; i < s->num_extents; i++) { > + =A0 =A0 =A0 =A0ret |=3D bdrv_flush(s->extents[i].file); This could produce an invalid return code (e.g. ORing together two different errnos). I think the best you can do is: for (...) { ret =3D bdrv_flush(s->extents[i].file); if (ret < 0) { err =3D ret; } } return err; This loses multiple errnos but it doesn't have the potential to corrupt the= m. Stefan