Received: from eggs.gnu.org ([2001:4830:134:3::10]:60906) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLk5i-00024T-CH for qemu-devel@nongnu.org; Wed, 11 Feb 2015 22:05:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLk5d-00016U-6c for qemu-devel@nongnu.org; Wed, 11 Feb 2015 22:05:22 -0500 Received: from [59.151.112.132] (port=57794 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLk5c-00014D-SQ for qemu-devel@nongnu.org; Wed, 11 Feb 2015 22:05:17 -0500 From: Wen Congyang Date: Thu, 12 Feb 2015 11:07:06 +0800 Message-ID: <1423710438-14377-3-git-send-email-wency@cn.fujitsu.com> In-Reply-To: <1423710438-14377-1-git-send-email-wency@cn.fujitsu.com> References: <1423710438-14377-1-git-send-email-wency@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [RFC PATCH 02/14] quorom: add a new read pattern List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu devel , Kevin Wolf , Stefan Hajnoczi , Paolo Bonzini Cc: Lai Jiangshan , Jiang Yunhong , Dong Eddie , "Dr. David Alan Gilbert" , Luiz Capitulino , Gonglei , Yang Hongyang , Michael Roth , zhanghailiang To block replication, we only need to read from the first child. Signed-off-by: Wen Congyang Signed-off-by: zhanghailiang Signed-off-by: Gonglei Cc: Luiz Capitulino Cc: Michael Roth --- block/quorum.c | 5 +++-- qapi/block-core.json | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/block/quorum.c b/block/quorum.c index 437b122..5ed1ff8 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -286,9 +286,10 @@ static void quorum_aio_cb(void *opaque, int ret) BDRVQuorumState *s = acb->common.bs->opaque; bool rewrite = false; - if (acb->is_read && s->read_pattern == QUORUM_READ_PATTERN_FIFO) { + if (acb->is_read && s->read_pattern != QUORUM_READ_PATTERN_QUORUM) { /* We try to read next child in FIFO order if we fail to read */ - if (ret < 0 && ++acb->child_iter < s->num_children) { + if (s->read_pattern == QUORUM_READ_PATTERN_FIFO && + ret < 0 && ++acb->child_iter < s->num_children) { read_fifo_child(acb); return; } diff --git a/qapi/block-core.json b/qapi/block-core.json index a3fdaf0..d6382e9 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1618,9 +1618,11 @@ # # @fifo: read only from the first child that has not failed # +# @first: read only from the first child +# # Since: 2.2 ## -{ 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] } +{ 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo', 'first' ] } ## # @BlockdevOptionsQuorum -- 2.1.0