Assuming some arguments come from sys while the epoch is passed is a bad
convention.  In addition the next patch will add a caller that doesn't
take the nodes array from sys.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 sheep/group.c      |   10 +++++-----
 sheep/ops.c        |    4 ++--
 sheep/sheep_priv.h |    2 +-
 sheep/store.c      |    8 ++++----
 4 files changed, 12 insertions(+), 12 deletions(-)

Index: sheepdog/sheep/group.c
===================================================================
--- sheepdog.orig/sheep/group.c	2012-05-14 21:16:32.551883383 +0200
+++ sheepdog/sheep/group.c	2012-05-14 21:18:08.543882463 +0200
@@ -564,7 +564,7 @@ static void finish_join(struct join_mess
 
 	if ((msg->cluster_status == SD_STATUS_OK ||
 	     msg->cluster_status == SD_STATUS_HALT) && msg->inc_epoch)
-		update_epoch_log(sys->epoch);
+		update_epoch_log(sys->epoch, sys->nodes, sys->nr_nodes);
 
 	if (!sd_store && strlen((char *)msg->store)) {
 		sd_store = find_store_driver((char *)msg->store);
@@ -596,7 +596,7 @@ static void update_cluster_info(struct j
 	    msg->cluster_status == SD_STATUS_HALT) {
 		if (msg->inc_epoch) {
 			sys->epoch++;
-			update_epoch_log(sys->epoch);
+			update_epoch_log(sys->epoch, sys->nodes, sys->nr_nodes);
 			update_epoch_store(sys->epoch);
 		}
 		/* Fresh node */
@@ -869,7 +869,7 @@ static void __sd_leave_done(struct event
 	if (sys_can_recover()) {
 		sys->epoch++;
 		update_epoch_store(sys->epoch);
-		update_epoch_log(sys->epoch);
+		update_epoch_log(sys->epoch, sys->nodes, sys->nr_nodes);
 	}
 	update_vnode_info();
 
@@ -1182,10 +1182,10 @@ void sd_join_handler(struct sd_node *joi
 		nr = nr_members;
 		nr_leave = get_nodes_nr_from(&sys->leave_list);
 
-		dprintf("%d == %d + %d \n", nr_local, nr, nr_leave);
+		dprintf("%d == %d + %d\n", nr_local, nr, nr_leave);
 		if (nr_local == nr + nr_leave) {
 			sys_stat_set(SD_STATUS_OK);
-			update_epoch_log(sys->epoch);
+			update_epoch_log(sys->epoch, sys->nodes, sys->nr_nodes);
 			update_epoch_store(sys->epoch);
 		}
 		break;
@@ -1223,10 +1223,10 @@ void sd_join_handler(struct sd_node *joi
 		nr = nr_members;
 		nr_leave = get_nodes_nr_from(&sys->leave_list);
 
-		dprintf("%d == %d + %d \n", nr_local, nr, nr_leave);
+		dprintf("%d == %d + %d\n", nr_local, nr, nr_leave);
 		if (nr_local == nr + nr_leave) {
 			sys_stat_set(SD_STATUS_OK);
-			update_epoch_log(sys->epoch);
+			update_epoch_log(sys->epoch, sys->nodes, sys->nr_nodes);
 			update_epoch_store(sys->epoch);
 		}
 
Index: sheepdog/sheep/ops.c
===================================================================
--- sheepdog.orig/sheep/ops.c	2012-05-14 21:16:32.551883383 +0200
+++ sheepdog/sheep/ops.c	2012-05-14 21:16:34.023883368 +0200
@@ -255,7 +255,7 @@ static int cluster_make_fs(const struct
 	sys->epoch = 1;
 	sys->recovered_epoch = 1;
 
-	ret = update_epoch_log(sys->epoch);
+	ret = update_epoch_log(sys->epoch, sys->nodes, sys->nr_nodes);
 	if (ret)
 		return SD_RES_EIO;
 
@@ -506,7 +506,7 @@ static int cluster_manual_recover(const
 		sys->nr_copies);
 
 	sys->epoch++; /* some nodes are left, so we get a new epoch */
-	ret = update_epoch_log(sys->epoch);
+	ret = update_epoch_log(sys->epoch, sys->nodes, sys->nr_nodes);
 	if (ret) {
 		ret = SD_RES_EIO;
 		sys->epoch--;
Index: sheepdog/sheep/sheep_priv.h
===================================================================
--- sheepdog.orig/sheep/sheep_priv.h	2012-05-14 21:16:32.555883382 +0200
+++ sheepdog/sheep/sheep_priv.h	2012-05-14 21:16:34.023883368 +0200
@@ -267,7 +267,7 @@ int read_epoch(uint32_t *epoch, uint64_t
 void do_cluster_request(struct work *work);
 
 int update_epoch_store(uint32_t epoch);
-int update_epoch_log(uint32_t epoch);
+int update_epoch_log(uint32_t epoch, struct sd_node *nodes, size_t nr_nodes);
 
 int set_cluster_copies(uint8_t copies);
 int get_cluster_copies(uint8_t *copies);
Index: sheepdog/sheep/store.c
===================================================================
--- sheepdog.orig/sheep/store.c	2012-05-14 21:16:32.555883382 +0200
+++ sheepdog/sheep/store.c	2012-05-14 21:16:34.023883368 +0200
@@ -254,13 +254,13 @@ int update_epoch_store(uint32_t epoch)
 	return 0;
 }
 
-int update_epoch_log(uint32_t epoch)
+int update_epoch_log(uint32_t epoch, struct sd_node *nodes, size_t nr_nodes)
 {
 	int fd, ret, len;
 	time_t t;
 	char path[PATH_MAX];
 
-	dprintf("update epoch: %d, %d\n", epoch, sys->nr_nodes);
+	dprintf("update epoch: %d, %zd\n", epoch, nr_nodes);
 
 	snprintf(path, sizeof(path), "%s%08u", epoch_path, epoch);
 	fd = open(path, O_RDWR | O_CREAT | O_DSYNC, def_fmode);
@@ -269,8 +269,8 @@ int update_epoch_log(uint32_t epoch)
 		goto err_open;
 	}
 
-	len = sys->nr_nodes * sizeof(struct sd_node);
-	ret = write(fd, (char *)sys->nodes, len);
+	len = nr_nodes * sizeof(struct sd_node);
+	ret = write(fd, (char *)nodes, len);
 	if (ret != len)
 		goto err;
 


