summaryrefslogtreecommitdiffstats
path: root/xlators/performance/io-threads/src/io-threads.c
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-05-02 14:37:04 +0530
committerAnand V. Avati <avati@amp.gluster.com>2009-05-05 12:09:34 +0530
commit9aea45a0e1338a10558c4f3f434d172c4bc8c209 (patch)
treed3972ea2915ecb5d147909e2bb561be733940e07 /xlators/performance/io-threads/src/io-threads.c
parent80c30634da16f7b333d07eeff9839b70d577e39f (diff)
io-threads: Clarify thread count range
This patch cleans up io-threads behaviour regarding the range values that can be specified for min-threads and max-threads. THe major change is that the min threads have been reduced to 2 to signify that io-threads needs minimum two threads for its operation, while keeping the default number of threads at 16. The idea is to decouple the default thread count from the minimum thread count. Note to Avati: This applies over Raghu's indentation and logging take-3 patch. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'xlators/performance/io-threads/src/io-threads.c')
-rw-r--r--xlators/performance/io-threads/src/io-threads.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c
index ebcb9e68c6e..98e212ba28d 100644
--- a/xlators/performance/io-threads/src/io-threads.c
+++ b/xlators/performance/io-threads/src/io-threads.c
@@ -2168,7 +2168,7 @@ init (xlator_t *this)
{
iot_conf_t *conf = NULL;
dict_t *options = this->options;
- int thread_count = IOT_MIN_THREADS;
+ int thread_count = IOT_DEFAULT_THREADS;
gf_boolean_t autoscaling = IOT_SCALING_OFF;
char *scalestr = NULL;
int min_threads, max_threads;
@@ -2205,10 +2205,10 @@ init (xlator_t *this)
"'autoscaling' on. Ignoring"
"'thread-count' option.");
if (thread_count < 2)
- thread_count = 2;
+ thread_count = IOT_MIN_THREADS;
}
- min_threads = IOT_MIN_THREADS;
+ min_threads = IOT_DEFAULT_THREADS;
max_threads = IOT_MAX_THREADS;
if (dict_get (options, "min-threads"))
min_threads = data_to_int32 (dict_get (options,
@@ -2247,12 +2247,12 @@ init (xlator_t *this)
* some strange reason, make sure we set this count to
* 2. Explained later.
*/
- if (min_threads < 2)
- min_threads = 2;
+ if (min_threads < IOT_MIN_THREADS)
+ min_threads = IOT_MIN_THREADS;
/* Again, have atleast two. Read on. */
- if (max_threads < 2)
- max_threads = 2;
+ if (max_threads < IOT_MIN_THREADS)
+ max_threads = IOT_MIN_THREADS;
/* This is why we need atleast two threads.
* We're dividing the specified thread pool into
@@ -2360,15 +2360,21 @@ struct volume_options options[] = {
{ .key = {"autoscaling"},
.type = GF_OPTION_TYPE_BOOL
},
- { .key = {"min-threads"},
- .type = GF_OPTION_TYPE_INT,
- .min = IOT_MIN_THREADS,
- .max = IOT_MAX_THREADS
+ { .key = {"min-threads"},
+ .type = GF_OPTION_TYPE_INT,
+ .min = IOT_MIN_THREADS,
+ .max = IOT_MAX_THREADS,
+ .description = "Minimum number of threads must be greater than or "
+ "equal to 2. If the specified value is less than 2 "
+ "it is adjusted upwards to 2. This is a requirement"
+ " for the current model of threading in io-threads."
},
- { .key = {"max-threads"},
- .type = GF_OPTION_TYPE_INT,
- .min = IOT_MIN_THREADS,
- .max = IOT_MAX_THREADS
+ { .key = {"max-threads"},
+ .type = GF_OPTION_TYPE_INT,
+ .min = IOT_MIN_THREADS,
+ .max = IOT_MAX_THREADS,
+ .description = "Maximum number of threads is advisory only so the "
+ "user specified value will be used."
},
{ .key = {NULL} },
};