summaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre/lnet/libcfs/module.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2017-12-18 12:25:19 +1100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-01-08 16:03:44 +0100
commit0aa211e39857f17e24126c47f6e3fe3b971344b3 (patch)
treef09add87abb47f1fe670dfb97d3e3d19d2007386 /drivers/staging/lustre/lnet/libcfs/module.c
parentd487fe31f49e78f3cdd826923bf0c340a839ffd8 (diff)
downloadlinux-0aa211e39857f17e24126c47f6e3fe3b971344b3.tar.gz
linux-0aa211e39857f17e24126c47f6e3fe3b971344b3.tar.bz2
linux-0aa211e39857f17e24126c47f6e3fe3b971344b3.zip
staging: lustre: libcfs: use a workqueue for rehash work.
lustre has a work-item queuing scheme that provides the same functionality as linux work_queues. To make the code easier for linux devs to follow, change to use work_queues. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/lnet/libcfs/module.c')
-rw-r--r--drivers/staging/lustre/lnet/libcfs/module.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/staging/lustre/lnet/libcfs/module.c b/drivers/staging/lustre/lnet/libcfs/module.c
index 4ead55920e79..eb1a1dea723d 100644
--- a/drivers/staging/lustre/lnet/libcfs/module.c
+++ b/drivers/staging/lustre/lnet/libcfs/module.c
@@ -554,12 +554,10 @@ static int libcfs_init(void)
goto cleanup_deregister;
}
- /* max to 4 threads, should be enough for rehash */
- rc = min(cfs_cpt_weight(cfs_cpt_table, CFS_CPT_ANY), 4);
- rc = cfs_wi_sched_create("cfs_rh", cfs_cpt_table, CFS_CPT_ANY,
- rc, &cfs_sched_rehash);
- if (rc) {
- CERROR("Startup workitem scheduler: error: %d\n", rc);
+ cfs_rehash_wq = alloc_workqueue("cfs_rh", WQ_SYSFS, 4);
+ if (!cfs_rehash_wq) {
+ CERROR("Failed to start rehash workqueue.\n");
+ rc = -ENOMEM;
goto cleanup_deregister;
}
@@ -590,9 +588,9 @@ static void libcfs_exit(void)
lustre_remove_debugfs();
- if (cfs_sched_rehash) {
- cfs_wi_sched_destroy(cfs_sched_rehash);
- cfs_sched_rehash = NULL;
+ if (cfs_rehash_wq) {
+ destroy_workqueue(cfs_rehash_wq);
+ cfs_rehash_wq = NULL;
}
cfs_crypto_unregister();