From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPUvX-0005AL-Kb for qemu-devel@nongnu.org; Fri, 27 Sep 2013 06:05:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VPUvS-0003Qt-5m for qemu-devel@nongnu.org; Fri, 27 Sep 2013 06:05:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27376) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPUvR-0003Qp-Su for qemu-devel@nongnu.org; Fri, 27 Sep 2013 06:05:30 -0400 Date: Fri, 27 Sep 2013 12:05:26 +0200 From: Kevin Wolf Message-ID: <20130927100526.GJ2440@dhcp-200-207.str.redhat.com> References: <1359392845-15905-1-git-send-email-benoit@irqsave.net> <1359392845-15905-7-git-send-email-benoit@irqsave.net> <5114EA67.5000308@redhat.com> <20130926164630.GF3338@irqsave.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20130926164630.GF3338@irqsave.net> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC V8 06/13] quorum: Add quorum mechanism. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?Beno=EEt?= Canet Cc: qemu-devel@nongnu.org, stefanha@redhat.com Am 26.09.2013 um 18:46 hat Beno=EEt Canet geschrieben: > Le Friday 08 Feb 2013 =E0 13:07:03 (+0100), Kevin Wolf a =E9crit : > > Am 28.01.2013 18:07, schrieb Beno=EEt Canet: > > > Use gnutls's SHA-256 to compare versions. > > >=20 > > > Signed-off-by: Benoit Canet > > > --- > > > block/quorum.c | 303 ++++++++++++++++++++++++++++++++++++++++++++= +++++++++++- > > > configure | 22 ++++ > > > 2 files changed, 324 insertions(+), 1 deletion(-) > > > +static bool quorum_iovec_compare(QEMUIOVector *a, QEMUIOVector *b) > > > +{ > > > + int i; > > > + int result; > > > + > > > + assert(a->niov =3D=3D b->niov); > > > + for (i =3D 0; i < a->niov; i++) { > > > + assert(a->iov[i].iov_len =3D=3D b->iov[i].iov_len); > > > + result =3D memcmp(a->iov[i].iov_base, > > > + b->iov[i].iov_base, > > > + a->iov[i].iov_len); > > > + if (result) { > > > + return false; > > > + } > > > + } > > > + > > > + return true; > > > +} > >=20 > > qemu_iovec_compare() seems to do exactly the same, except that this > > doesn't return the offset of the first difference. > >=20 > > Why is it a good idea to duplicate the code? >=20 > Quorum need speed: qemu_iovec_compare will do byte level comparison whe= reas > memcmp will use SSE on large block. Fair enough. > > > + /* we have a winner: copy it */ > > > + quorum_copy_qiov(acb->qiov, &acb->aios[winner->index].qiov); > > > + > > > + /* some versions are bad print them */ > > > + quorum_print_bad_versions(acb, &winner->value); > >=20 > > Same here. Is this driver meant to be used in production or only for > > debugging? Maybe it should have a debug mode that must explicitly be > > enabled and messages are only printed in this mode? >=20 > Quorum needs to communicate some event to the user for maintainance. > Would thowing QMP events be better ? Yes, absolutely. Error messages on stderr end up in a log file at best and can only be read by human administrators. Using QMP enables management tools to take action. Kevin