[Sheepdog] [PATCH v2 1/3] sheep: use update_epoch_log() to write epoch logs

Liu Yuan namei.unix at gmail.com
Wed Oct 26 05:35:29 CEST 2011


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

We should unify the function calls to write epoch logs and we just need one.
epoch_log_write() will be removed in next patch.

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/group.c |    6 +-----
 sheep/ops.c   |    9 +++------
 2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/sheep/group.c b/sheep/group.c
index 7d5064b..edf04a8 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -766,13 +766,9 @@ static void __sd_leave_done(struct cpg_event *cevent)
 	sys->nr_vnodes = nodes_to_vnodes(sys->nodes, sys->nr_nodes,
 					 sys->vnodes);
 	if (sys_can_recover()) {
-		dprintf("update epoch, %d, %d\n", sys->epoch + 1, sys->nr_nodes);
-		epoch_log_write(sys->epoch + 1, (char *)sys->nodes,
-				sizeof(*sys->nodes) * sys->nr_nodes);
-
 		sys->epoch++;
-
 		update_epoch_store(sys->epoch);
+		update_epoch_log(sys->epoch);
 	}
 
 	print_node_list(sys->nodes, sys->nr_nodes);
diff --git a/sheep/ops.c b/sheep/ops.c
index e52c721..743eb0f 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -148,13 +148,10 @@ static int cluster_make_fs(const struct sd_req *req, struct sd_rsp *rsp,
 	sys->epoch = 1;
 	sys->recovered_epoch = 1;
 
-	dprintf("write epoch log, %d, %d\n", sys->epoch, sys->nr_nodes);
-	ret = epoch_log_write(sys->epoch, (char *)sys->nodes,
-			      sys->nr_nodes * sizeof(struct sheepdog_node_list_entry));
-	if (ret < 0) {
-		eprintf("can't write epoch %u\n", sys->epoch);
+	ret = update_epoch_log(sys->epoch);
+	if (ret)
 		return SD_RES_EIO;
-	}
+
 	update_epoch_store(sys->epoch);
 
 	set_cluster_copies(sys->nr_sobjs);
-- 
1.7.6.1




More information about the sheepdog mailing list