summaryrefslogtreecommitdiffstats
path: root/xlators/performance/io-threads
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2011-07-12 05:33:36 +0000
committerAnand Avati <avati@gluster.com>2011-07-12 09:03:38 -0700
commitaa9f9c3113009f136642e9bdedfcef6d04d85b44 (patch)
tree10899fcdb168758652416e190d4f14050604edf2 /xlators/performance/io-threads
parent14426adfe61fde6c6e6367a6025f314046ed8aa5 (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
Diffstat (limited to 'xlators/performance/io-threads')
-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 e791b941ae9..c88f812a4eb 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)
@@ -2157,11 +2157,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,
@@ -2184,10 +2185,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,
@@ -2204,8 +2218,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;
@@ -2292,7 +2306,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,