All of lore.kernel.org
 help / color / mirror / Atom feed
From: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
To: Eric Blake <eblake@redhat.com>,
	qemu devel <qemu-devel@nongnu.org>,
	Alberto Garcia <berto@igalia.com>, Kevin Wolf <kwolf@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/1] quorum: change vote rules for 64 bits hash
Date: Tue, 16 Feb 2016 09:37:22 +0800	[thread overview]
Message-ID: <56C27D52.9050701@cn.fujitsu.com> (raw)
In-Reply-To: <56C2069A.7090607@redhat.com>

On 02/16/2016 01:10 AM, Eric Blake wrote:
> On 02/15/2016 02:52 AM, Changlong Xie wrote:
>> Before:
>> 1) vote_count > max: winner = candidate, update max
>> 2) vote_count <= max: do nothing
>> Current:
>> 1) vote_count > max: winner = candidate, update max
>> 2) vote_count = max: compare the value of winner with
>> candidate, if candidate->value.l == 0, winner = 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?

Surely, will do in next version.

>
>>
>> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
>> Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
>> ---
>>   block/quorum.c | 14 ++++++++++----
>>   1 file changed, 10 insertions(+), 4 deletions(-)
>>
>> 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, int i, QuorumVoteValue *hash)
>>       return 0;
>>   }
>>
>> -static QuorumVoteVersion *quorum_get_vote_winner(QuorumVotes *votes)
>> +static QuorumVoteVersion *quorum_get_vote_winner(QuorumVotes *votes, bool vote_error)
>
> Long line. Please wrap things to stay within 80 columns.
>

Ok

>>   {
>>       int max = 0;
>>       QuorumVoteVersion *candidate, *winner = NULL;
>> @@ -455,6 +455,12 @@ static QuorumVoteVersion *quorum_get_vote_winner(QuorumVotes *votes)
>>           if (candidate->vote_count > max) {
>>               max = candidate->vote_count;
>>               winner = candidate;
>> +            continue;
>> +        }
>> +        /* For 64 bit hash */
>> +        if (vote_error == true && candidate->vote_count == max
>
> s/ == true// (no need to do a redundant comparison of a bool against a
> bool).

Ok

Thanks
	-Xie

>
>

      reply	other threads:[~2016-02-16  1:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15  9:52 [Qemu-devel] [PATCH 0/1] change quorum vote rules for 64-bits hash Changlong Xie
2016-02-15  9:52 ` [Qemu-devel] [PATCH 1/1] quorum: change vote rules for 64 bits hash Changlong Xie
2016-02-15 17:10   ` Eric Blake
2016-02-16  1:37     ` Changlong Xie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56C27D52.9050701@cn.fujitsu.com \
    --to=xiecl.fnst@cn.fujitsu.com \
    --cc=berto@igalia.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.