From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53030) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WA55x-0000Mo-OX for qemu-devel@nongnu.org; Sun, 02 Feb 2014 17:00:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WA55s-0002cd-OR for qemu-devel@nongnu.org; Sun, 02 Feb 2014 17:00:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45648) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WA55s-0002cZ-EF for qemu-devel@nongnu.org; Sun, 02 Feb 2014 17:00:48 -0500 Message-ID: <52EEC091.1000906@redhat.com> Date: Sun, 02 Feb 2014 23:02:57 +0100 From: Max Reitz MIME-Version: 1.0 References: <1390927974-31325-1-git-send-email-benoit.canet@irqsave.net> <1390927974-31325-11-git-send-email-benoit.canet@irqsave.net> In-Reply-To: <1390927974-31325-11-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 10/13] quorum: Add quorum_co_flush(). 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 > > Makes a vote to select error if any. > > Signed-off-by: Benoit Canet > --- > block/quorum.c | 34 ++++++++++++++++++++++++++++++++++ > 1 file changed, 34 insertions(+) > > diff --git a/block/quorum.c b/block/quorum.c > index 9b0718b..1b84b07 100644 > --- a/block/quorum.c > +++ b/block/quorum.c > @@ -653,12 +653,46 @@ free_exit: > return result; > } > =20 > +static coroutine_fn int quorum_co_flush(BlockDriverState *bs) > +{ > + BDRVQuorumState *s =3D bs->opaque; > + QuorumVoteVersion *winner =3D NULL; > + QuorumVotes error_votes; > + QuorumVoteValue result_value; > + int i; > + int result =3D 0; > + bool error =3D false; > + > + QLIST_INIT(&error_votes.vote_list); > + error_votes.compare =3D quorum_64bits_compare; > + > + for (i =3D 0; i < s->total; i++) { > + result =3D bdrv_co_flush(s->bs[i]); > + if (result) { > + error =3D true; > + result_value.l =3D result; > + quorum_count_vote(&error_votes, &result_value, i); > + } > + } > + > + if (error) { > + winner =3D quorum_get_vote_winner(&error_votes); > + result =3D winner->value.l; > + } > + > + quorum_free_vote_list(&error_votes); > + > + return result; > +} > + > static BlockDriver bdrv_quorum =3D { > .format_name =3D "quorum", > .protocol_name =3D "quorum", > =20 > .instance_size =3D sizeof(BDRVQuorumState), > =20 > + .bdrv_co_flush_to_disk =3D quorum_co_flush, > + > .bdrv_getlength =3D quorum_getlength, > =20 > .bdrv_aio_readv =3D quorum_aio_readv, So, my general opinion on this patch (for reads/writes we don't vote on=20 the error code either; so why here?) hasn't changed, but well, I=20 definitely don't oppose it. Another problem, however: If any error occurs, this function will return=20 an error as well. Is that intended? If an error on a read/write=20 operation occurs but there are still enough successful reads/writes to=20 reach quorum, no error is returned. Is there a reason why this should be=20 different for flush? Max