diff options
Diffstat (limited to 'svc_dev.c')
-rw-r--r-- | svc_dev.c | 22 |
1 files changed, 18 insertions, 4 deletions
@@ -310,6 +310,14 @@ static void svc_rescale_warn_fix_capa(struct mog_svc *svc, size_t ndev_new) svc->thr_per_dev = 1; } +static void mog_svc_dev_rescale_all(struct mog_svc *svc) +{ + /* 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)); +} + /* rescaling only happens in the main thread */ void mog_svc_dev_user_rescale(struct mog_svc *svc, size_t ndev_new) { @@ -319,9 +327,15 @@ void mog_svc_dev_user_rescale(struct mog_svc *svc, size_t ndev_new) svc->thr_per_dev = svc->user_set_aio_threads / ndev_new; svc_rescale_warn_fix_capa(svc, ndev_new); + mog_svc_dev_rescale_all(svc); +} - /* 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)); +/* + * this forces ioqs to detect contention and yield, + * leading to quicker shutdown + */ +void mog_svc_dev_quit_prepare(struct mog_svc *svc) +{ + svc->thr_per_dev = 1; + mog_svc_dev_rescale_all(svc); } |