From: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
To: Alberto Garcia <berto@igalia.com>,
qemu devel <qemu-devel@nongnu.org>,
Eric Blake <eblake@redhat.com>, Kevin Wolf <kwolf@redhat.com>,
Max Reitz <mreitz@redhat.com>,
Markus Armbruster <armbru@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v5 2/3] qmp event: Refactor QUORUM_REPORT_BAD
Date: Thu, 25 Feb 2016 10:44:17 +0800 [thread overview]
Message-ID: <56CE6A81.70606@cn.fujitsu.com> (raw)
In-Reply-To: <w5137si1e1d.fsf@maestria.local.igalia.com>
On 02/24/2016 08:35 PM, Alberto Garcia wrote:
> On Wed 24 Feb 2016 11:11:54 AM CET, Changlong Xie wrote:
>> -static void quorum_report_bad(QuorumAIOCB *acb, char *node_name, int ret)
>> +static void quorum_report_bad(QuorumOpType type, QuorumAIOCB *acb,
>> + char *node_name, int ret)
>> {
>> const char *msg = NULL;
>> if (ret < 0) {
>> msg = strerror(-ret);
>> }
>> - qapi_event_send_quorum_report_bad(!!msg, msg, node_name,
>> - acb->sector_num, acb->nb_sectors, &error_abort);
>> +
>> + switch (type) {
>> + case QUORUM_OP_TYPE_READ:
>> + case QUORUM_OP_TYPE_WRITE:
>> + qapi_event_send_quorum_report_bad(false, 0, !!msg, msg, node_name,
>> + acb->sector_num, acb->nb_sectors,
>> + &error_abort);
>> + break;
>> + case QUORUM_OP_TYPE_FLUSH:
>> + qapi_event_send_quorum_report_bad(true, type, !!msg, msg, node_name,
>> + 0, 0, &error_abort);
>> + break;
>
> A few comments:
>
> - Why don't you set the 'type' field in read and write operations? You
> defined all three values but you are only using 'flush' here.
>
> - For the case of flush you could set sectors-count to the total size
> of the BlockDriverState as Eric suggested (bdrv_nb_sectors(bs)).
> Setting both to 0 could confuse clients that are not ready to deal
> with flush failures.
>
> - Since the QuorumAIOCB parameter is not used in the flush case, you
> could replace it from the function prototype and use sector_num and
> nb_sectors instead. That way you can also omit the switch.
>
Surely, all your suggestions are helpful. Also i will add "Reviewed-by"
in patch 1/3, 3/3 in next version.
Thanks
-Xie
> Berto
>
>
> .
>
next prev parent reply other threads:[~2016-02-25 2:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-24 10:11 [Qemu-devel] [PATCH v5 0/3] modify vote rules for flush operation Changlong Xie
2016-02-24 10:11 ` [Qemu-devel] [PATCH v5 1/3] docs: fix invalid node name in qmp event Changlong Xie
2016-02-24 10:21 ` Alberto Garcia
2016-02-24 10:11 ` [Qemu-devel] [PATCH v5 2/3] qmp event: Refactor QUORUM_REPORT_BAD Changlong Xie
2016-02-24 12:35 ` Alberto Garcia
2016-02-24 16:57 ` Eric Blake
2016-02-25 2:44 ` Changlong Xie [this message]
2016-02-24 16:59 ` Eric Blake
2016-02-25 0:50 ` Wen Congyang
2016-02-25 1:12 ` Eric Blake
2016-02-25 1:24 ` Changlong Xie
2016-02-24 10:11 ` [Qemu-devel] [PATCH v5 3/3] quorum: modify vote rules for flush operation Changlong Xie
2016-02-24 12:38 ` Alberto Garcia
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=56CE6A81.70606@cn.fujitsu.com \
--to=xiecl.fnst@cn.fujitsu.com \
--cc=armbru@redhat.com \
--cc=berto@igalia.com \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).