From: levin li <xingke.lwp at taobao.com> Signed-off-by: levin li <xingke.lwp at taobao.com> --- sheep/ops.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/sheep/ops.c b/sheep/ops.c index 8aa6b34..47000f1 100644 --- a/sheep/ops.c +++ b/sheep/ops.c @@ -494,6 +494,17 @@ static int cluster_notify_vdi_del(const struct sd_req *req, struct sd_rsp *rsp, return objlist_cache_cleanup(vid); } +static int local_set_cache_size(const struct sd_req *req, struct sd_rsp *rsp, + void *data) +{ + int cache_size = *(int *)data; + + uatomic_set(&sys->cache_size, cache_size); + dprintf("Max cache size set to %dM\n", cache_size); + + return SD_RES_SUCCESS; +} + static int cluster_restore(const struct sd_req *req, struct sd_rsp *rsp, void *data) { @@ -951,6 +962,12 @@ 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, + }, + /* gateway I/O operations */ [SD_OP_CREATE_AND_WRITE_OBJ] = { .name = "CREATE_AND_WRITE_OBJ", -- 1.7.1 |