[sheepdog] [PATCH 1/2] collie: remove 'node cache' option

Liu Yuan namei.unix at gmail.com
Wed May 29 06:59:20 CEST 2013


'node cache' to set object cache size is easy to cause problems and no use case.

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 collie/node.c            |   35 -----------------------------------
 include/internal_proto.h |    2 +-
 sheep/ops.c              |   19 -------------------
 3 files changed, 1 insertion(+), 55 deletions(-)

diff --git a/collie/node.c b/collie/node.c
index 85729b4..0cd7e7a 100644
--- a/collie/node.c
+++ b/collie/node.c
@@ -150,39 +150,6 @@ static int node_recovery(int argc, char **argv)
 	return EXIT_SUCCESS;
 }
 
-static int node_cache(int argc, char **argv)
-{
-	char *p;
-	int ret;
-	uint32_t cache_size;
-	struct sd_req hdr;
-	struct sd_rsp *rsp = (struct sd_rsp *)&hdr;
-
-	cache_size = strtol(argv[optind], &p, 10);
-	if (argv[optind] == p || cache_size < 0) {
-		fprintf(stderr, "Invalid cache size %s\n", argv[optind]);
-		return EXIT_FAILURE;
-	}
-
-	sd_init_req(&hdr, SD_OP_SET_CACHE_SIZE);
-	hdr.flags = SD_FLAG_CMD_WRITE;
-	hdr.data_length = sizeof(cache_size);
-
-	ret = collie_exec_req(sdhost, sdport, &hdr, (void *)&cache_size);
-	if (ret < 0)
-		return EXIT_FAILURE;
-
-	if (rsp->result != SD_RES_SUCCESS) {
-		fprintf(stderr, "specify max cache size failed: %s\n",
-				sd_strerror(rsp->result));
-		return EXIT_FAILURE;
-	}
-
-	printf("Max cache size set to %dM\n", cache_size);
-
-	return EXIT_SUCCESS;
-}
-
 static int node_kill(int argc, char **argv)
 {
 	char host[128];
@@ -362,8 +329,6 @@ static struct subcommand node_cmd[] = {
 	 SUBCMD_FLAG_NEED_NODELIST, node_info},
 	{"recovery", NULL, "aprh", "show nodes in recovery", NULL,
 	 SUBCMD_FLAG_NEED_NODELIST, node_recovery},
-	{"cache", "<cache size>", "aprh", "specify max cache size", NULL,
-	 SUBCMD_FLAG_NEED_ARG, node_cache},
 	{"md", "[disks]", "apAh", "See 'collie node md' for more information",
 	 node_md_cmd, SUBCMD_FLAG_NEED_ARG, node_md, node_options},
 	{NULL,},
diff --git a/include/internal_proto.h b/include/internal_proto.h
index 83271ad..91450a0 100644
--- a/include/internal_proto.h
+++ b/include/internal_proto.h
@@ -60,7 +60,7 @@
 #define SD_OP_READ_PEER      0xA4
 #define SD_OP_WRITE_PEER     0xA5
 #define SD_OP_REMOVE_PEER    0xA6
-#define SD_OP_SET_CACHE_SIZE 0xA7
+/* #define SD_OP_SET_CACHE_SIZE 0xA7 deleted */
 #define SD_OP_ENABLE_RECOVER 0xA8
 #define SD_OP_DISABLE_RECOVER 0xA9
 #define SD_OP_GET_VDI_COPIES 0xAB
diff --git a/sheep/ops.c b/sheep/ops.c
index 0d35dad..145252e 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -768,19 +768,6 @@ static int cluster_update_size(const struct sd_req *req, struct sd_rsp *rsp,
 	return SD_RES_SUCCESS;
 }
 
-static int local_set_cache_size(const struct sd_req *req, struct sd_rsp *rsp,
-				  void *data)
-{
-	uint32_t cache_size = *(uint32_t *)data;
-
-	uatomic_set(&sys->object_cache_size, cache_size);
-	sd_dprintf("Max cache size set to %dM", cache_size);
-
-	object_cache_try_to_reclaim(0);
-
-	return SD_RES_SUCCESS;
-}
-
 static int local_md_info(struct request *request)
 {
 	struct sd_rsp *rsp = &request->rp;
@@ -1245,12 +1232,6 @@ static struct sd_op_template sd_ops[] = {
 		.process_main = local_kill_node,
 	},
 
-	[SD_OP_SET_CACHE_SIZE] = {
-		.name = "SET_CACHE_SIZE",
-		.type = SD_OP_TYPE_LOCAL,
-		.process_main = local_set_cache_size,
-	},
-
 	[SD_OP_MD_INFO] = {
 		.name = "MD_INFO",
 		.type = SD_OP_TYPE_LOCAL,
-- 
1.7.9.5




More information about the sheepdog mailing list