[sheepdog] [PATCH v2] sheep: disable object cache as default

Liu Yuan namei.unix at gmail.com
Mon Jul 2 11:55:04 CEST 2012


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

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 v2: change option 'W' -> 'w' in switch case
 
 man/sheep.8   |    2 +-
 sheep/sheep.c |   14 +++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/man/sheep.8 b/man/sheep.8
index 05e0516..94c46b9 100644
--- a/man/sheep.8
+++ b/man/sheep.8
@@ -56,7 +56,7 @@ Log to stdout instead of shared logger.
 .BI \-v "\fR, \fP" \--vnodes
 Specify the number of virtual nodes.
 .TP
-.BI \-W "\fR, \fP" \--disable-cache
+.BI \-w "\fR, \fP" \--enable-cache
 Disable object cache.
 .TP
 .BI \-y "\fR, \fP" \--myaddr
diff --git a/sheep/sheep.c b/sheep/sheep.c
index 67db023..1e694bc 100644
--- a/sheep/sheep.c
+++ b/sheep/sheep.c
@@ -47,12 +47,12 @@ static struct option const long_options[] = {
 	{"stdout", no_argument, NULL, 'o'},
 	{"port", required_argument, NULL, 'p'},
 	{"vnodes", required_argument, NULL, 'v'},
-	{"disable-cache", no_argument, NULL, 'W'},
+	{"enable-cache", no_argument, NULL, 'w'},
 	{"zone", required_argument, NULL, 'z'},
 	{NULL, 0, NULL, 0},
 };
 
-static const char *short_options = "c:dDfg:Ghi:l:op:v:Wy:z:";
+static const char *short_options = "c:dDfg:Ghi:l:op:v:wy:z:";
 
 static void usage(int status)
 {
@@ -76,7 +76,7 @@ Options:\n\
   -o, --stdout            log to stdout instead of shared logger\n\
   -p, --port              specify the TCP port on which to listen\n\
   -v, --vnodes            specify the number of virtual nodes\n\
-  -W, --disable-cache     disable object cache\n\
+  -w, --enable-cache      enable object cache\n\
   -y, --myaddr            specify the address advertised to other sheep\n\
   -z, --zone              specify the zone id\n\
 ", PACKAGE_VERSION, program_name);
@@ -116,7 +116,7 @@ int main(int argc, char **argv)
 	int af;
 	char *p;
 	struct cluster_driver *cdrv;
-	int enable_write_cache = 1; /* enabled by default */
+	int enable_write_cache = 0; /* disabled by default */
 
 	signal(SIGPIPE, SIG_IGN);
 
@@ -198,9 +198,9 @@ int main(int argc, char **argv)
 			}
 			sys->this_node.zone = zone;
 			break;
-		case 'W':
-			vprintf(SDOG_INFO, "disable write cache\n");
-			enable_write_cache = 0;
+		case 'w':
+			vprintf(SDOG_INFO, "enable write cache\n");
+			enable_write_cache = 1;
 			break;
 		case 'v':
 			nr_vnodes = strtol(optarg, &p, 10);
-- 
1.7.10.2




More information about the sheepdog mailing list