[Sheepdog] [PATCH RFC 1/2] sheep: add a new helper to update epoch log

Liu Yuan namei.unix at gmail.com
Sun Sep 18 05:35:24 CEST 2011


From: Liu Yuan <tailai.ly at taobao.com>

This is intended for later patch set use to reduce duplicate code.

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/group.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/sheep/group.c b/sheep/group.c
index bd10e39..83d85cf 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -617,6 +617,22 @@ static int move_node_to_sd_list(uint32_t nodeid, uint32_t pid,
 	return 0;
 }
 
+static int update_epoch_log(int epoch)
+{
+	int ret, nr_nodes;
+	struct sheepdog_node_list_entry entry[SD_MAX_NODES];
+
+	nr_nodes = get_ordered_sd_node_list(entry);
+
+	dprintf("update epoch, %d, %d\n", epoch, nr_nodes);
+	ret = epoch_log_write(epoch, (char *)entry,
+			nr_nodes * sizeof(struct sheepdog_node_list_entry));
+	if (ret < 0)
+		eprintf("can't write epoch %u\n", epoch);
+
+	return ret;
+}
+
 static void update_cluster_info(struct join_message *msg)
 {
 	int i;
-- 
1.7.5.1




More information about the sheepdog mailing list