From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52873) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVMfo-0001Nt-Ed for qemu-devel@nongnu.org; Mon, 15 Feb 2016 12:11:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVMfk-0004Ut-8n for qemu-devel@nongnu.org; Mon, 15 Feb 2016 12:10:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53226) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVMfj-0004Un-I3 for qemu-devel@nongnu.org; Mon, 15 Feb 2016 12:10:51 -0500 References: <1455529968-21772-1-git-send-email-xiecl.fnst@cn.fujitsu.com> <1455529968-21772-2-git-send-email-xiecl.fnst@cn.fujitsu.com> From: Eric Blake Message-ID: <56C2069A.7090607@redhat.com> Date: Mon, 15 Feb 2016 10:10:50 -0700 MIME-Version: 1.0 In-Reply-To: <1455529968-21772-2-git-send-email-xiecl.fnst@cn.fujitsu.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="KL2256jfem5MH8FXqsvnmEkBQJT2exapS" Subject: Re: [Qemu-devel] [PATCH 1/1] quorum: change vote rules for 64 bits hash List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Changlong Xie , qemu devel , Alberto Garcia , Kevin Wolf Cc: "Dr. David Alan Gilbert" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --KL2256jfem5MH8FXqsvnmEkBQJT2exapS Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/15/2016 02:52 AM, Changlong Xie wrote: > Before: > 1) vote_count > max: winner =3D candidate, update max > 2) vote_count <=3D max: do nothing > Current: > 1) vote_count > max: winner =3D candidate, update max > 2) vote_count =3D max: compare the value of winner with > candidate, if candidate->value.l =3D=3D 0, winner =3D candidate, > else do nothing > 3) vote_count < max: do nothing This says what you did, but not why. Can you demonstrate a scenario that is broken without the patch, as part of your commit message? >=20 > Signed-off-by: Wen Congyang > Signed-off-by: Changlong Xie > --- > block/quorum.c | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) >=20 > diff --git a/block/quorum.c b/block/quorum.c > index a5ae4b8..e431ff4 100644 > --- a/block/quorum.c > +++ b/block/quorum.c > @@ -446,7 +446,7 @@ static int quorum_compute_hash(QuorumAIOCB *acb, in= t i, QuorumVoteValue *hash) > return 0; > } > =20 > -static QuorumVoteVersion *quorum_get_vote_winner(QuorumVotes *votes) > +static QuorumVoteVersion *quorum_get_vote_winner(QuorumVotes *votes, b= ool vote_error) Long line. Please wrap things to stay within 80 columns. > { > int max =3D 0; > QuorumVoteVersion *candidate, *winner =3D NULL; > @@ -455,6 +455,12 @@ static QuorumVoteVersion *quorum_get_vote_winner(Q= uorumVotes *votes) > if (candidate->vote_count > max) { > max =3D candidate->vote_count; > winner =3D candidate; > + continue; > + } > + /* For 64 bit hash */ > + if (vote_error =3D=3D true && candidate->vote_count =3D=3D max= s/ =3D=3D true// (no need to do a redundant comparison of a bool against = a bool). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --KL2256jfem5MH8FXqsvnmEkBQJT2exapS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWwgaaAAoJEKeha0olJ0NqE4kIAIfcyzH9QXzkHw+ftMc8rBP5 VgqwLOd0lo/EE/C/XptQaL6FAA41qPSo1RcH2HhByDNrY/JG48tLwlqei8jFrrBy 1p3xw0OZu3UGVxnVlop4KcWXdALjUOoSH+2XcIqJagTpoSdhA2GLjCxmc+JVMC11 9celLI4kxlH3kJLNDQZaRtqt/ZyQiJHlzbzJ5ICM6UxoivyGokfsUrHsYJl75wf2 7i2w2byc2IeBUfazsIWN7RK/GvJLtEV/1sgh8V4y9iFGsQgCyzzMQXMj8Gjr3WL3 hpF7O/seZM8rowSUiCz9JWIHB4DsRPrMHuLoSIf+WKUU6PWgDNTb0XKl+f28BSU= =tOR5 -----END PGP SIGNATURE----- --KL2256jfem5MH8FXqsvnmEkBQJT2exapS--