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

Kai Zhang kyle at zelin.io
Mon Jul 8 06:20:48 CEST 2013


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);
 
 	list_del(&block->list);
 	free(block);
-- 
1.7.9.5




More information about the sheepdog mailing list