[Sheepdog] [PATCH] sheep: need not get many copies of bitmap

yaohaiting.wujue at gmail.com yaohaiting.wujue at gmail.com
Thu May 10 04:50:52 CEST 2012


From: HaiTing Yao <wujue.yht at taobao.com>

When a node joins the formatted cluster, it should get VDI bitmap from
the other nodes. Since the bitmap in every node of formatted cluster is
same, it only need get once.

Signed-off-by: HaiTing Yao <wujue.yht at taobao.com>
---
 sheep/group.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/sheep/group.c b/sheep/group.c
index c7fd387..334df6d 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -514,11 +514,11 @@ out:
 
 static void get_vdi_bitmap_from_sd_list(void)
 {
-	int i;
 	/* fixme: we need this until starting up. */
 
-	for (i = 0; i < sys->nr_nodes; i++)
-		get_vdi_bitmap_from(sys->nodes + i);
+	/* get bitmap from the first node */
+	if (sys->nr_nodes)
+		get_vdi_bitmap_from(sys->nodes);
 }
 
 static void finish_join(struct join_message *msg, struct sd_node *joined,
@@ -711,7 +711,6 @@ static void __sd_join(struct event_struct *cevent)
 {
 	struct work_join *w = container_of(cevent, struct work_join, cev);
 	struct join_message *msg = w->jm;
-	int i;
 
 	if (msg->cluster_status != SD_STATUS_OK &&
 	    msg->cluster_status != SD_STATUS_HALT)
@@ -721,8 +720,8 @@ static void __sd_join(struct event_struct *cevent)
 		return;
 
 	get_vdi_bitmap_from_sd_list();
-	for (i = 0; i < w->member_list_entries; i++)
-		get_vdi_bitmap_from(w->member_list + i);
+	/* get bitmap from the first node */
+	get_vdi_bitmap_from(w->member_list);
 }
 
 static void __sd_leave(struct event_struct *cevent)
-- 
1.7.1




More information about the sheepdog mailing list