From ee9b0aab614b56aa8f3c8ed56ced88f769c0ee47 Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Thu, 12 Feb 2015 17:29:28 +0530 Subject: client/server: fix reconfigure for event-threads option Change-Id: Ica8bca13e4feb941e22651b642b848be165ccc9e BUG: 1104462 Signed-off-by: Krishnan Parthasarathi Reviewed-on: http://review.gluster.org/9648 Reviewed-by: Shyamsundar Ranganathan Reviewed-by: Pranith Kumar Karampuri Reviewed-by: Atin Mukherjee Tested-by: Gluster Build System Reviewed-by: Raghavendra G Tested-by: Raghavendra G --- xlators/protocol/client/src/client.c | 28 ++++++++++++++-------------- xlators/protocol/server/src/server.c | 28 +++++++++++++--------------- 2 files changed, 27 insertions(+), 29 deletions(-) (limited to 'xlators') diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index 32952b49fbb..b919e4c80a5 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -2560,20 +2560,15 @@ out: } int -client_check_event_threads (xlator_t *this, dict_t *options, clnt_conf_t *conf) +client_check_event_threads (xlator_t *this, clnt_conf_t *conf, int32_t old, + int32_t new) { - int ret = -1; - int eventthreads = 0; - - /* Read event-threads from the new configuration */ - ret = dict_get_int32 (options, "event-threads", &eventthreads); - if (!ret) { - conf->event_threads = eventthreads; - } - ret = event_reconfigure_threads (this->ctx->event_pool, - conf->event_threads); + if (old == new) + return 0; - return ret; + conf->event_threads = new; + return event_reconfigure_threads (this->ctx->event_pool, + conf->event_threads); } int @@ -2586,6 +2581,7 @@ reconfigure (xlator_t *this, dict_t *options) char *new_remote_subvol = NULL; char *old_remote_host = NULL; char *new_remote_host = NULL; + int32_t new_nthread = 0; conf = this->private; @@ -2595,7 +2591,10 @@ reconfigure (xlator_t *this, dict_t *options) GF_OPTION_RECONF ("ping-timeout", conf->opt.ping_timeout, options, int32, out); - ret = client_check_event_threads (this, options, conf); + GF_OPTION_RECONF ("event-threads", new_nthread, options, + int32, out); + ret = client_check_event_threads (this, conf, conf->event_threads, + new_nthread); if (ret) goto out; @@ -2679,7 +2678,8 @@ init (xlator_t *this) /* Set event threads to the configured default */ GF_OPTION_INIT("event-threads", conf->event_threads, int32, out); - ret = client_check_event_threads (this, this->options, conf); + ret = client_check_event_threads (this, conf, STARTING_EVENT_THREADS, + conf->event_threads); if (ret) goto out; diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c index 97389116023..ac1feb96779 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -675,21 +675,15 @@ out: } int -server_check_event_threads (xlator_t *this, dict_t *options, - server_conf_t *conf) +server_check_event_threads (xlator_t *this, server_conf_t *conf, int32_t old, + int32_t new) { - int ret = -1; - int eventthreads = 0; - - /* Read event-threads from the new configuration */ - ret = dict_get_int32 (options, "event-threads", &eventthreads); - if (!ret) { - conf->event_threads = eventthreads; - } - ret = event_reconfigure_threads (this->ctx->event_pool, - conf->event_threads); + if (old == new) + return 0; - return ret; + conf->event_threads = new; + return event_reconfigure_threads (this->ctx->event_pool, + conf->event_threads); } int @@ -705,6 +699,7 @@ reconfigure (xlator_t *this, dict_t *options) int ret = 0; char *statedump_path = NULL; xlator_t *xl = NULL; + int32_t new_nthread = 0; conf = this->private; @@ -811,7 +806,9 @@ reconfigure (xlator_t *this, dict_t *options) } } - ret = server_check_event_threads (this, options, conf); + GF_OPTION_RECONF ("event-threads", new_nthread, options, int32, out); + ret = server_check_event_threads (this, conf, conf->event_threads, + new_nthread); if (ret) goto out; @@ -876,7 +873,8 @@ init (xlator_t *this) /* Set event threads to the configured default */ GF_OPTION_INIT("event-threads", conf->event_threads, int32, out); - ret = server_check_event_threads (this, this->options, conf); + ret = server_check_event_threads (this, conf, STARTING_EVENT_THREADS, + conf->event_threads); if (ret) goto out; -- cgit