[Sheepdog] [PATCH v3 1/3] sheep: use update_epoch_log() to write epoch logs
Liu Yuan
namei.unix at gmail.com
Wed Oct 26 15:18:14 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 cc0fdf0..d9bf201 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -770,13 +770,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 2d9b241..92c739b 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