[Sheepdog] [PATCH 2/2] farm: refactor trunk_file_write()

Liu Yuan namei.unix at gmail.com
Mon Apr 30 13:05:52 CEST 2012


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

Since we already have a dedicated funciton trunk_file_write_recovery()
for system recovery handling, we don't have 'user' flag for
trunk_file_write() and simply rename it as trunk_file_write_user()

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/farm/farm.c  |    2 +-
 sheep/farm/farm.h  |    2 +-
 sheep/farm/trunk.c |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sheep/farm/farm.c b/sheep/farm/farm.c
index 6e9e748..838962c 100644
--- a/sheep/farm/farm.c
+++ b/sheep/farm/farm.c
@@ -546,7 +546,7 @@ static int farm_snapshot(struct siocb *iocb)
 
 	epoch = log_nr + 1;
 	dprintf("user epoch %d\n", epoch);
-	if (trunk_file_write(trunk_sha1, 1) < 0)
+	if (trunk_file_write_user(trunk_sha1) < 0)
 		goto out;
 
 	if (snap_file_write(epoch, trunk_sha1, snap_sha1, 1) < 0)
diff --git a/sheep/farm/farm.h b/sheep/farm/farm.h
index 07259a0..e26c179 100644
--- a/sheep/farm/farm.h
+++ b/sheep/farm/farm.h
@@ -61,7 +61,7 @@ extern int sha1_file_try_delete(const unsigned char *sha1);
 /* trunk.c */
 extern int trunk_init(void);
 extern int trunk_file_write_recovery(unsigned char *outsha1);
-extern int trunk_file_write(unsigned char *outsha1, int user);
+extern int trunk_file_write_user(unsigned char *outsha1);
 extern void *trunk_file_read(unsigned char *sha1, struct sha1_file_hdr *);
 extern int trunk_update_entry(uint64_t oid);
 extern void trunk_reset(void);
diff --git a/sheep/farm/trunk.c b/sheep/farm/trunk.c
index 88f9910..881f37d 100644
--- a/sheep/farm/trunk.c
+++ b/sheep/farm/trunk.c
@@ -310,7 +310,7 @@ out:
 	return ret;
 }
 
-int trunk_file_write(unsigned char *outsha1, int user)
+int trunk_file_write_user(unsigned char *outsha1)
 {
 	struct strbuf buf;
 	uint64_t data_size = sizeof(struct trunk_entry) * trunk_entry_active_nr;
-- 
1.7.8.2




More information about the sheepdog mailing list