From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53505) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VS6lC-0001Ol-7B for qemu-devel@nongnu.org; Fri, 04 Oct 2013 10:53:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VS6l6-0003MA-Nf for qemu-devel@nongnu.org; Fri, 04 Oct 2013 10:53:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57895) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VS6l6-0003M3-Ee for qemu-devel@nongnu.org; Fri, 04 Oct 2013 10:53:36 -0400 Message-ID: <524ED66B.2090306@redhat.com> Date: Fri, 04 Oct 2013 16:53:31 +0200 From: Max Reitz MIME-Version: 1.0 References: <1380717564-11098-1-git-send-email-benoit@irqsave.net> <1380717564-11098-11-git-send-email-benoit@irqsave.net> In-Reply-To: <1380717564-11098-11-git-send-email-benoit@irqsave.net> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH V9 10/11] quorum: Add quorum_co_flush(). List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?ISO-8859-15?Q?Beno=EEt_Canet?= Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com On 2013-10-02 14:39, Beno=EEt Canet wrote: > Makes a vote to select error if any. Voting on the error code seems a little over the top to me. ;) I mean, the idea's nice, but then you'd have to do the same for reads=20 and writes, I think. Just doing this for flushes seems a little incoheren= t. Max > 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 084d030..0a28ab1 100644 > --- a/block/quorum.c > +++ b/block/quorum.c > @@ -641,12 +641,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,