[sheepdog] [PATCH v2 1/4] zookeeper: remove unneccessary zk operation

Liu Yuan namei.unix at gmail.com
Mon Jul 8 06:37:43 CEST 2013


On Mon, Jul 08, 2013 at 12:29:46PM +0800, Liu Yuan wrote:
> On Sun, Jul 07, 2013 at 09:20:48PM -0700, Kai Zhang wrote:
> > Current implementation of zk_handle_unblock() sends an NOTIFY event to
> > all sheep. All sheep who receive NOTIFY event will call
> > sd_notify_handler() to do unblock.
> > However, this is unncessary, we can call sd_notify_handler() directly
> > in zk_handle_unblock().
> > And this how corosync driver handle unblock.
> > 
> > Signed-off-by: Kai Zhang <kyle at zelin.io>
> > ---
> >  sheep/cluster/zookeeper.c |    3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/sheep/cluster/zookeeper.c b/sheep/cluster/zookeeper.c
> > index aafc18d..29a1237 100644
> > --- a/sheep/cluster/zookeeper.c
> > +++ b/sheep/cluster/zookeeper.c
> > @@ -978,8 +978,7 @@ static void zk_handle_unblock(struct zk_event *ev)
> >  	if (list_empty(&zk_block_list))
> >  		return;
> >  	block = list_first_entry(&zk_block_list, typeof(*block), list);
> > -	if (block->callbacked)
> > -		add_event(EVENT_NOTIFY, block, ev->buf, ev->buf_len);
> > +	sd_notify_handler(&ev->sender.node, ev->buf, ev->buf_len);
> 
> This is wrong as we previously discussed.
> 

Oops, with a second thought, you seem to be right.

Thanks
Yuan



More information about the sheepdog mailing list