about summary refs log tree commit homepage
path: root/thrpool.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-06-21 03:34:12 +0000
committerEric Wong <normalperson@yhbt.net>2013-06-25 21:24:53 +0000
commite90b43119ff33fb591ffb3bc100cf847537ca5fb (patch)
treeef181b44f4c323aaf53df2716017982616816b69 /thrpool.c
parent2acbe7f4001de74091282ee199e3cad50c2e3e7f (diff)
downloadcmogstored-e90b43119ff33fb591ffb3bc100cf847537ca5fb.tar.gz
This simplifies code, reduces contention, and reduces the
chances of independent MogileFS instances (with one instance
of cmogstored) stepping over each other.

Most cmogstored deployments are single docroot (for a single
instance of MogileFS), however cmogstored supports multiple
docroots for some rare configurations and we support them here.
Diffstat (limited to 'thrpool.c')
-rw-r--r--thrpool.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/thrpool.c b/thrpool.c
index cf1afba..7167239 100644
--- a/thrpool.c
+++ b/thrpool.c
@@ -24,6 +24,7 @@ size_t mog_user_set_aio_threads;
 #  define MOG_THR_STACK_SIZE (0)
 #endif
 static const size_t stacksize = (size_t)MOG_THR_STACK_SIZE;
+static const size_t thr_per_dev = 10;
 
 static pthread_mutex_t sat_lock = PTHREAD_MUTEX_INITIALIZER;
 struct sat_arg;
@@ -138,7 +139,7 @@ out:
 /* this is only called by the main (notify) thread */
 void mog_thrpool_update(struct mog_queue *q, size_t ndev_old, size_t ndev_new)
 {
-        size_t size = ndev_new * 10;
+        size_t size = ndev_new * thr_per_dev;
         struct mog_thrpool *tp = &q->thrpool;
 
         if (mog_user_set_aio_threads) {
@@ -158,6 +159,9 @@ void mog_thrpool_update(struct mog_queue *q, size_t ndev_old, size_t ndev_new)
                 return;
         }
 
+        if (size < thr_per_dev)
+                size = thr_per_dev;
+
         if (ndev_old)
                 syslog(LOG_INFO,
                        "devcount(%zu->%zu), updating server aio_threads=%zu",