diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-07-11 22:15:56 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-07-12 00:21:06 +0000 |
commit | e50365f275ada4afcd5f25f2ac3328e341a79d71 (patch) | |
tree | 0e0d1b5ee52424ab2c0fa125b4f31fedbd83e2a4 /svc_dev.c | |
parent | f83d0466afc32542f3f4ff962105c817a1be2c96 (diff) | |
download | cmogstored-e50365f275ada4afcd5f25f2ac3328e341a79d71.tar.gz |
Users reducing or increasing thread counts should increase ioq capacity, otherwise there's no point in having more or less threads if they are synched to the ioq capacity.
Diffstat (limited to 'svc_dev.c')
-rw-r--r-- | svc_dev.c | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -293,3 +293,35 @@ void mog_mkusage_all(void) { mog_svc_each(svc_mkusage_each, NULL); } + +/* we should never set ioq_max == 0 */ +static void svc_rescale_warn_fix_capa(struct mog_svc *svc, size_t ndev_new) +{ + if (svc->thr_per_dev != 0) + return; + + syslog(LOG_WARNING, + "serving %s with fewer aio_threads(%zu) than devices(%zu)", + svc->docroot, svc->user_set_aio_threads, ndev_new); + syslog(LOG_WARNING, + "set \"server aio_threads = %zu\" or higher via sidechannel", + ndev_new); + + svc->thr_per_dev = 1; +} + +/* rescaling only happens in the main thread */ +void mog_svc_dev_user_rescale(struct mog_svc *svc, size_t ndev_new) +{ + assert(svc->user_set_aio_threads && + "user did not set aio_threads via sidechannel"); + + svc->thr_per_dev = svc->user_set_aio_threads / ndev_new; + + svc_rescale_warn_fix_capa(svc, ndev_new); + + /* iterate through each device of this svc */ + CHECK(int, 0, pthread_mutex_lock(&svc->by_mog_devid_lock)); + hash_do_for_each(svc->by_mog_devid, mog_dev_user_rescale_i, svc); + CHECK(int, 0, pthread_mutex_unlock(&svc->by_mog_devid_lock)); +} |