diff options
-rw-r--r-- | cmogstored.h | 3 | ||||
-rw-r--r-- | dev.c | 21 | ||||
-rw-r--r-- | svc_dev.c | 12 |
3 files changed, 7 insertions, 29 deletions
diff --git a/cmogstored.h b/cmogstored.h index 3e03fce..84da3a9 100644 --- a/cmogstored.h +++ b/cmogstored.h @@ -393,8 +393,7 @@ bool mog_svc_atfork_child(void *svc_ptr, void *parent); struct mog_dev *mog_dev_for(struct mog_svc *, uint32_t mog_devid, bool update); int mog_dev_mkusage(const struct mog_dev *, struct mog_svc *); void mog_dev_free(struct mog_dev *); -bool mog_dev_user_rescale_i(void *devp, void *svcp); -bool mog_dev_requeue_prepare(void *devp, void *ign); +void mog_dev_requeue_prepare(struct mog_dev *); /* valid_path.rl */ int mog_valid_path(const char *buf, size_t len); @@ -236,27 +236,8 @@ void mog_dev_free(struct mog_dev *dev) free(dev); } -/* - * Only called by the main/notify thread as a hash iterator function - * This increases or decreases the capacity of a given device if a - * a sidechannel user changes the worker thread pool size. - */ -bool mog_dev_user_rescale_i(void *devp, void *svcp) +void mog_dev_requeue_prepare(struct mog_dev *dev) { - struct mog_dev *dev = devp; - struct mog_svc *svc = svcp; - - mog_ioq_adjust(&dev->ioq, svc->thr_per_dev); - - return true; /* continue iteration */ -} - -bool mog_dev_requeue_prepare(void *devp, void *ign) -{ - struct mog_dev *dev = devp; - mog_ioq_requeue_prepare(&dev->ioq); mog_ioq_requeue_prepare(&dev->fsckq); - - return true; /* continue iteration */ } @@ -310,27 +310,25 @@ static void svc_rescale_warn_fix_capa(struct mog_svc *svc, unsigned ndev_new) svc->thr_per_dev = 1; } +/* Only called by the main/notify thread */ static void mog_svc_dev_rescale_all(struct mog_svc *svc) { struct mog_dev *dev; - khash_t(by_mog_devid) *h; + khash_t(by_mog_devid) *h = svc->by_mog_devid; - /* iterate through each device of this svc */ CHECK(int, 0, pthread_mutex_lock(&svc->by_mog_devid_lock)); - h = svc->by_mog_devid; - mog_kh_foreach_key(h, dev, mog_dev_user_rescale_i(dev, svc)); + mog_kh_foreach_key(h, dev, mog_ioq_adjust(&dev->ioq, svc->thr_per_dev)); CHECK(int, 0, pthread_mutex_unlock(&svc->by_mog_devid_lock)); } void mog_svc_dev_requeue_prepare(struct mog_svc *svc) { struct mog_dev *dev; - khash_t(by_mog_devid) *h; + khash_t(by_mog_devid) *h = svc->by_mog_devid; /* iterate through each device of this svc */ CHECK(int, 0, pthread_mutex_lock(&svc->by_mog_devid_lock)); - h = svc->by_mog_devid; - mog_kh_foreach_key(h, dev, mog_dev_requeue_prepare(dev, svc)); + mog_kh_foreach_key(h, dev, mog_dev_requeue_prepare(dev)); CHECK(int, 0, pthread_mutex_unlock(&svc->by_mog_devid_lock)); } |