[sheepdog] [PATCH 7/7] local: add more debug outputs

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Tue Sep 4 10:05:43 CEST 2012


Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 sheep/cluster/local.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/sheep/cluster/local.c b/sheep/cluster/local.c
index 609dfb0..5d2f423 100644
--- a/sheep/cluster/local.c
+++ b/sheep/cluster/local.c
@@ -157,11 +157,14 @@ static void shm_queue_notify(void)
 	int i;
 	size_t nr;
 	pid_t pids[SD_MAX_NODES];
+	struct sd_node nodes[SD_MAX_NODES];
 
-	nr = get_nodes(NULL, pids);
+	nr = get_nodes(nodes, pids);
 
-	for (i = 0; i < nr; i++)
+	for (i = 0; i < nr; i++) {
+		dprintf("send signal to %s\n", node_to_str(nodes + i));
 		kill(pids[i], SIGUSR1);
+	}
 }
 
 static int is_shm_queue_valid(void)
@@ -218,7 +221,7 @@ static void shm_queue_init(void)
 static void add_event(enum local_event_type type, struct sd_node *node,
 		void *buf, size_t buf_len)
 {
-	int idx;
+	int idx, i;
 	struct sd_node *n;
 	pid_t *p;
 	struct local_event ev = {
@@ -256,6 +259,10 @@ static void add_event(enum local_event_type type, struct sd_node *node,
 		abort();
 	}
 
+	dprintf("type = %d, sender = %s\n", ev.type, node_to_str(&ev.sender));
+	for (i = 0; i < ev.nr_nodes; i++)
+		dprintf("%d: %s\n", i, node_to_str(ev.nodes + i));
+
 	shm_queue_push(&ev);
 
 	shm_queue_notify();
@@ -361,11 +368,17 @@ static bool local_process_event(void)
 {
 	struct local_event *ev;
 	enum cluster_join_result res;
+	int i;
 
 	ev = shm_queue_peek();
 	if (!ev)
 		return false;
 
+	dprintf("type = %d, sender = %s\n", ev->type, node_to_str(&ev->sender));
+	dprintf("callbacked = %d, removed = %d\n", ev->callbacked, ev->removed);
+	for (i = 0; i < ev->nr_nodes; i++)
+		dprintf("%d: %s\n", i, node_to_str(ev->nodes + i));
+
 	if (ev->removed)
 		goto out;
 
-- 
1.7.2.5




More information about the sheepdog mailing list