[sheepdog] [PATCH] sheep: don't call get_latest_epoch() twice

Liu Yuan namei.unix at gmail.com
Fri Mar 29 12:35:22 CET 2013


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

It is nonsense calling this function twice.

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

diff --git a/sheep/group.c b/sheep/group.c
index c8d966c..98b916f 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -1243,13 +1243,12 @@ int create_cluster(int port, int64_t zone, int nr_vnodes,
 
 	sys->this_node.space = sys->disk_space;
 
-	if (get_latest_epoch() > 0) {
+	sys->epoch = get_latest_epoch();
+	if (sys->epoch) {
 		sys->status = SD_STATUS_WAIT_FOR_JOIN;
-
 		get_cluster_copies(&sys->nr_copies);
 		get_cluster_flags(&sys->flags);
 
-		sys->epoch = get_latest_epoch();
 	} else {
 		sys->status = SD_STATUS_WAIT_FOR_FORMAT;
 	}
-- 
1.7.9.5




More information about the sheepdog mailing list