Received: from eggs.gnu.org ([2001:4830:134:3::10]:58350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMxg9-0008Fd-Pu for qemu-devel@nongnu.org; Wed, 05 Aug 2015 08:20:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZMxg5-0005fm-H3 for qemu-devel@nongnu.org; Wed, 05 Aug 2015 08:20:17 -0400 From: Alberto Garcia In-Reply-To: <1436258596-1253-3-git-send-email-wency@cn.fujitsu.com> References: <1436258596-1253-1-git-send-email-wency@cn.fujitsu.com> <1436258596-1253-3-git-send-email-wency@cn.fujitsu.com> Date: Wed, 05 Aug 2015 14:19:30 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH COLO-BLOCK v8 02/18] quorum: implement block driver interfaces add/delete a BDS's child List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wen Congyang , qemu devel , Fam Zheng , Max Reitz , Paolo Bonzini , Stefan Hajnoczi Cc: Kevin Wolf , qemu block , Jiang Yunhong , Dong Eddie , "Dr. David Alan Gilbert" , "Michael R. Hines" , Gonglei , Yang Hongyang , zhanghailiang On Tue 07 Jul 2015 10:43:00 AM CEST, Wen Congyang wrote: > Signed-off-by: Wen Congyang > Signed-off-by: zhanghailiang > Signed-off-by: Gonglei > Cc: Alberto Garcia Sorry for being so late with this, I was on holidays during July. > +static void quorum_del_child(BlockDriverState *bs, BlockDriverState *child_bs, > + Error **errp) > +{ > + BDRVQuorumState *s = bs->opaque; > + int i; > + > + for (i = 0; i < s->num_children; i++) { > + if (s->bs[i] == child_bs) { > + break; > + } > + } > + > + if (i == s->num_children) { > + error_setg(errp, "Invalid child"); > + return; > + } > + > + if (s->num_children <= s->threshold) { > + error_setg(errp, "Cannot remove any more child"); > + return; > + } I think that should be "Cannot remove any more children". You could also make it a bit more explanatory by saying "The number of children cannot be lower than the vote threshold" or something like that. > + bdrv_drain(bs); > + /* We can safe remove this child now */ > + memmove(&s->bs[i], &s->bs[i+1], (s->num_children - i - 1) * sizeof(void *)); s/safe/safely/ Apart from that, the code looks good to me, so Reviewed-by: Alberto Garcia Berto