diff options
author | Kaushik BV <kaushikbv@gluster.com> | 2011-07-15 01:20:13 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-07-17 07:46:48 -0700 |
commit | 3426188d20d0ee624b67198eca9eed9582122de3 (patch) | |
tree | b5490bc7206217d27146c518c6dd4f6d6121223c | |
parent | 0496d47afcf34365bbdffbee5917b7dc341c9d4c (diff) |
io-threads: changes in volume_options to assist volume set help/help-xml
Signed-off-by: Kaushik BV <kaushikbv@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 2041 (volume set help option)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2041
BUG: 2041 (volume set help option)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2041
-rw-r--r-- | xlators/performance/io-threads/src/io-threads.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index 91bb75d92a6..af5521d3d36 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -36,7 +36,7 @@ void *iot_worker (void *arg); int iot_workers_scale (iot_conf_t *conf); int __iot_workers_scale (iot_conf_t *conf); - +struct volume_options options[]; call_stub_t * __iot_dequeue (iot_conf_t *conf) @@ -2163,11 +2163,12 @@ int init (xlator_t *this) { iot_conf_t *conf = NULL; - dict_t *options = this->options; + dict_t *xl_options = this->options; int thread_count = IOT_DEFAULT_THREADS; int idle_time = IOT_DEFAULT_IDLE; int ret = -1; int i = 0; + char *def_val = NULL; if (!this->children || this->children->next) { gf_log ("io-threads", GF_LOG_ERROR, @@ -2202,10 +2203,23 @@ init (xlator_t *this) set_stack_size (conf); - thread_count = IOT_DEFAULT_THREADS; + if (xlator_get_volopt_info (&this->volume_options, "thread-count", + &def_val, NULL)) { + gf_log (this->name, GF_LOG_ERROR, "Default value of " + "thread-count not found"); + ret = -1; + goto out; + } else { + if (gf_string2int32 (def_val, &conf->max_count)) { + gf_log (this->name, GF_LOG_ERROR, "Default value of " + "thread corrupt"); + ret = -1; + goto out; + } + } - if (dict_get (options, "thread-count")) { - thread_count = data_to_int32 (dict_get (options, + if (dict_get (xl_options, "thread-count")) { + thread_count = data_to_int32 (dict_get (xl_options, "thread-count")); if (thread_count < IOT_MIN_THREADS) { gf_log ("io-threads", GF_LOG_WARNING, @@ -2222,8 +2236,8 @@ init (xlator_t *this) } conf->max_count = thread_count; - if (dict_get (options, "idle-time")) { - idle_time = data_to_int32 (dict_get (options, + if (dict_get (xl_options, "idle-time")) { + idle_time = data_to_int32 (dict_get (xl_options, "idle-time")); if (idle_time < 0) idle_time = 1; @@ -2310,7 +2324,11 @@ struct volume_options options[] = { { .key = {"thread-count"}, .type = GF_OPTION_TYPE_INT, .min = IOT_MIN_THREADS, - .max = IOT_MAX_THREADS + .max = IOT_MAX_THREADS, + .default_value = "16", + .description = "Number of threads in IO threads translator which " + "perform concurrent IO operations" + }, {.key = {"idle-time"}, .type = GF_OPTION_TYPE_INT, |