[Sheepdog] [PATCH] sheep: cleanup get_latest_epoch()

Liu Yuan namei.unix at gmail.com
Thu May 3 06:01:18 CEST 2012


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

return uint32_t instead of int

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

diff --git a/sheep/group.c b/sheep/group.c
index cc03d55..c7fd387 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -539,7 +539,8 @@ static void finish_join(struct join_message *msg, struct sd_node *joined,
 	qsort(sys->nodes, sys->nr_nodes, sizeof(*sys->nodes), node_cmp);
 
 	if (msg->cluster_status != SD_STATUS_OK) {
-		int nr_leave_nodes, le;
+		int nr_leave_nodes;
+		uint32_t le;
 
 		nr_leave_nodes = msg->nr_leave_nodes;
 		le = get_latest_epoch();
@@ -1099,7 +1100,7 @@ void sd_join_handler(struct sd_node *joined, struct sd_node *members,
 	int nr, nr_local, nr_leave;
 	struct node *n;
 	struct join_message *jm;
-	int le = get_latest_epoch();
+	uint32_t le = get_latest_epoch();
 
 	if (node_cmp(joined, &sys->this_node) == 0) {
 		if (result == CJ_RES_FAIL) {
diff --git a/sheep/ops.c b/sheep/ops.c
index 6b2dec3..b6f8eb2 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -226,7 +226,8 @@ static int cluster_make_fs(const struct sd_req *req, struct sd_rsp *rsp,
 			   void *data)
 {
 	const struct sd_so_req *hdr = (const struct sd_so_req *)req;
-	int i, latest_epoch, ret;
+	int i, ret;
+	uint32_t latest_epoch;
 	uint64_t created_time;
 	struct siocb iocb = { 0 };
 
@@ -389,8 +390,8 @@ static int local_stat_cluster(const struct sd_req *req, struct sd_rsp *rsp,
 			      void *data)
 {
 	struct epoch_log *log;
-	int i, max_logs, epoch;
-	uint32_t sys_stat = sys_stat_get();
+	int i, max_logs;
+	uint32_t sys_stat = sys_stat_get(), epoch;
 
 	max_logs = rsp->data_length / sizeof(*log);
 	epoch = get_latest_epoch();
diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h
index 9cb22d1..2275a93 100644
--- a/sheep/sheep_priv.h
+++ b/sheep/sheep_priv.h
@@ -283,7 +283,7 @@ int get_max_nr_copies_from(struct sd_node *entries, int nr);
 int epoch_log_read(uint32_t epoch, char *buf, int len);
 int epoch_log_read_nr(uint32_t epoch, char *buf, int len);
 int epoch_log_read_remote(uint32_t epoch, char *buf, int len);
-int get_latest_epoch(void);
+uint32_t get_latest_epoch(void);
 int set_cluster_ctime(uint64_t ctime);
 uint64_t get_cluster_ctime(void);
 int get_obj_list(const struct sd_list_req *, struct sd_list_rsp *, void *);
diff --git a/sheep/store.c b/sheep/store.c
index 7ef72c5..f8bf404 100644
--- a/sheep/store.c
+++ b/sheep/store.c
@@ -517,7 +517,7 @@ int epoch_log_read(uint32_t epoch, char *buf, int len)
 	return len;
 }
 
-int get_latest_epoch(void)
+uint32_t get_latest_epoch(void)
 {
 	DIR *dir;
 	struct dirent *d;
-- 
1.7.8.2




More information about the sheepdog mailing list