summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2010-02-27 07:00:10 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-02-27 09:34:04 -0800
commit904fef5cfece1e6eb69510b7409efe779867ca0a (patch)
treea09d9642b76bd590ac3bf3607e95884d87e7759c
parent042fe15e637c4bfe569d9b1c3a7e30889895c109 (diff)
io-threads: more fixes
* conditional for scaling up threads was wrong * ETIMEDOUT check was performed wrongly Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 583 (filesystem access hangs while deleting large files) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=583
-rw-r--r--xlators/performance/io-threads/src/io-threads.c19
-rw-r--r--xlators/performance/io-threads/src/io-threads.h2
2 files changed, 14 insertions, 7 deletions
diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c
index 5339ce9a8..feae1439e 100644
--- a/xlators/performance/io-threads/src/io-threads.c
+++ b/xlators/performance/io-threads/src/io-threads.c
@@ -79,7 +79,7 @@ iot_worker (void *data)
this = conf->this;
THIS = this;
- while (1) {
+ for (;;) {
sleep_till.tv_sec = time (NULL) + conf->idle_time;
pthread_mutex_lock (&conf->mutex);
@@ -92,7 +92,7 @@ iot_worker (void *data)
&sleep_till);
conf->sleep_count--;
- if (ret == -1 && errno == ETIMEDOUT) {
+ if (ret == ETIMEDOUT) {
timeout = 1;
break;
}
@@ -102,6 +102,9 @@ iot_worker (void *data)
if (conf->curr_count > IOT_MIN_THREADS) {
conf->curr_count--;
bye = 1;
+ gf_log (conf->this->name, GF_LOG_DEBUG,
+ "timeout, terminated. conf->curr_count=%d",
+ conf->curr_count);
} else {
timeout = 0;
}
@@ -811,7 +814,7 @@ iot_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
stub = fop_readv_stub (frame, iot_readv_wrapper, fd, size, offset);
if (!stub) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_log (this->name, GF_LOG_ERROR,
"cannot create readv call stub"
"(out of memory)");
ret = -ENOMEM;
@@ -2049,7 +2052,7 @@ __iot_workers_scale (iot_conf_t *conf)
scale = IOT_MIN_THREADS;
if (log2 > conf->max_count)
- scale = IOT_MAX_THREADS;
+ scale = conf->max_count;
if (conf->curr_count < scale) {
diff = scale - conf->curr_count;
@@ -2059,10 +2062,14 @@ __iot_workers_scale (iot_conf_t *conf)
diff --;
ret = pthread_create (&thread, &conf->w_attr, iot_worker, conf);
- if (ret == 0)
+ if (ret == 0) {
conf->curr_count++;
- else
+ gf_log (conf->this->name, GF_LOG_DEBUG,
+ "scaled threads to %d (queue_size=%d/%d)",
+ conf->curr_count, conf->queue_size, scale);
+ } else {
break;
+ }
}
return diff;
diff --git a/xlators/performance/io-threads/src/io-threads.h b/xlators/performance/io-threads/src/io-threads.h
index 8b9985be1..85836ff58 100644
--- a/xlators/performance/io-threads/src/io-threads.h
+++ b/xlators/performance/io-threads/src/io-threads.h
@@ -42,7 +42,7 @@ struct iot_conf;
#define MAX_IDLE_SKEW 4 /* In secs */
#define skew_sec_idle_time(sec) ((sec) + (random () % MAX_IDLE_SKEW))
-#define IOT_DEFAULT_IDLE 180 /* In secs. */
+#define IOT_DEFAULT_IDLE 120 /* In secs. */
#define IOT_MIN_THREADS 1
#define IOT_DEFAULT_THREADS 8