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

Liu Yuan namei.unix at gmail.com
Mon Jul 8 06:29:46 CEST 2013


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.

Thanks,
Yuan



More information about the sheepdog mailing list