summaryrefslogtreecommitdiffstats
path: root/xlators/performance
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/performance')
-rw-r--r--xlators/performance/io-threads/src/io-threads.c34
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,