From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W9Ltt-0003Ha-BV for qemu-devel@nongnu.org; Fri, 31 Jan 2014 16:45:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W9Ltn-0002K0-E2 for qemu-devel@nongnu.org; Fri, 31 Jan 2014 16:45:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36147) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W9Ltn-0002Iw-4v for qemu-devel@nongnu.org; Fri, 31 Jan 2014 16:45:19 -0500 Message-ID: <52EC19EA.7020207@redhat.com> Date: Fri, 31 Jan 2014 22:47:22 +0100 From: Max Reitz MIME-Version: 1.0 References: <1390927974-31325-1-git-send-email-benoit.canet@irqsave.net> <1390927974-31325-6-git-send-email-benoit.canet@irqsave.net> In-Reply-To: <1390927974-31325-6-git-send-email-benoit.canet@irqsave.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH V10 05/13] quorum: Add quorum_aio_readv. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QmVub8OudCBDYW5ldA==?= , qemu-devel@nongnu.org Cc: kwolf@redhat.com, =?UTF-8?B?QmVub8OudCBDYW5ldA==?= , stefanha@redhat.com On 28.01.2014 17:52, Beno=C3=AEt Canet wrote: > From: Beno=C3=AEt Canet > > Signed-off-by: Benoit Canet > --- > block/quorum.c | 40 +++++++++++++++++++++++++++++++++++++++- > 1 file changed, 39 insertions(+), 1 deletion(-) > > diff --git a/block/quorum.c b/block/quorum.c > index 85992ab..5bf37b3 100644 > --- a/block/quorum.c > +++ b/block/quorum.c > @@ -101,14 +101,23 @@ static int quorum_get_first_error(QuorumAIOCB *ac= b) > static void quorum_aio_finalize(QuorumAIOCB *acb) > { > BDRVQuorumState *s =3D acb->bqs; > - int ret; > + int i, ret; > =20 > ret =3D s->threshold <=3D acb->success_count ? 0 : quorum_get_fir= st_error(acb); > =20 > + for (i =3D 0; i < s->total; i++) { > + qemu_vfree(acb->aios[i].buf); > + acb->aios[i].buf =3D NULL; > + acb->aios[i].ret =3D 0; > + } With =E2=80=9Cfields=E2=80=9D I mean these as well (they are not set for = write=20 operations). ;-) But as I've said before, it doesn't actually make a difference whether=20 this is just executed for reads or also for writes, where these fields=20 are NULL and 0 already anyway, so: Reviewed-by: Max Reitz > + > acb->common.cb(acb->common.opaque, ret); > if (acb->finished) { > *acb->finished =3D true; > } > + for (i =3D 0; acb->is_read && i < s->total; i++) { This is a pretty elegant way to avoid an =E2=80=9Cif=E2=80=9D around the = loop, I have to=20 admit. *g* Max