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

Liu Yuan namei.unix at gmail.com
Wed Oct 26 05:26:47 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 |    4 +---
 sheep/ops.c   |    8 +++-----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/sheep/group.c b/sheep/group.c
index 7d5064b..fb5bc01 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -767,12 +767,10 @@ static void __sd_leave_done(struct cpg_event *cevent)
 					 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..7eb9a3b 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -149,12 +149,10 @@ static int cluster_make_fs(const struct sd_req *req, struct sd_rsp *rsp,
 	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