diff options
author | Ryan Moeller <[email protected]> | 2020-08-17 14:01:19 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2020-08-17 11:01:19 -0700 |
commit | 3c3d7c8a57b278063952fc671fc2cf1589e45a6a (patch) | |
tree | fe19eeb939c88e9bd47281d13064504c61c0dbfb /module/os | |
parent | fc34dfba8e8238683e90e3fa83d16be3343886f6 (diff) |
FreeBSD: Create taskq threads in appropriate proc
Stepping stone toward re-enabling spa_thread on FreeBSD.
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes #10715
Diffstat (limited to 'module/os')
-rw-r--r-- | module/os/freebsd/spl/spl_sysevent.c | 3 | ||||
-rw-r--r-- | module/os/freebsd/spl/spl_taskq.c | 27 | ||||
-rw-r--r-- | module/os/freebsd/zfs/zvol_os.c | 5 |
3 files changed, 19 insertions, 16 deletions
diff --git a/module/os/freebsd/spl/spl_sysevent.c b/module/os/freebsd/spl/spl_sysevent.c index 53520eeaf..8c0e49568 100644 --- a/module/os/freebsd/spl/spl_sysevent.c +++ b/module/os/freebsd/spl/spl_sysevent.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include <sys/malloc.h> #include <sys/kmem.h> #include <sys/list.h> +#include <sys/proc.h> #include <sys/sbuf.h> #include <sys/nvpair.h> #include <sys/sunddi.h> @@ -256,6 +257,6 @@ sysevent_worker(void *arg __unused) void ddi_sysevent_init(void) { - kproc_kthread_add(sysevent_worker, NULL, &zfsproc, NULL, 0, 0, + kproc_kthread_add(sysevent_worker, NULL, &system_proc, NULL, 0, 0, "zfskern", "sysevent"); } diff --git a/module/os/freebsd/spl/spl_taskq.c b/module/os/freebsd/spl/spl_taskq.c index 9cdf93ea9..049e889cf 100644 --- a/module/os/freebsd/spl/spl_taskq.c +++ b/module/os/freebsd/spl/spl_taskq.c @@ -44,6 +44,11 @@ __FBSDID("$FreeBSD$"); #include <vm/uma.h> +#if __FreeBSD_version < 1201522 +#define taskqueue_start_threads_in_proc(tqp, count, pri, proc, name, ...) \ + taskqueue_start_threads(tqp, count, pri, name, __VA_ARGS__) +#endif + static uint_t taskq_tsd; static uma_zone_t taskq_zone; @@ -51,6 +56,8 @@ taskq_t *system_taskq = NULL; taskq_t *system_delay_taskq = NULL; taskq_t *dynamic_taskq = NULL; +proc_t *system_proc; + extern int uma_align_cache; static MALLOC_DEFINE(M_TASKQ, "taskq", "taskq structures"); @@ -166,8 +173,8 @@ taskq_tsd_set(void *context) } static taskq_t * -taskq_create_with_init(const char *name, int nthreads, pri_t pri, - int minalloc __unused, int maxalloc __unused, uint_t flags) +taskq_create_impl(const char *name, int nthreads, pri_t pri, + proc_t *proc __maybe_unused, uint_t flags) { taskq_t *tq; @@ -181,8 +188,8 @@ taskq_create_with_init(const char *name, int nthreads, pri_t pri, taskq_tsd_set, tq); taskqueue_set_callback(tq->tq_queue, TASKQUEUE_CALLBACK_TYPE_SHUTDOWN, taskq_tsd_set, NULL); - (void) taskqueue_start_threads(&tq->tq_queue, nthreads, pri, - "%s", name); + (void) taskqueue_start_threads_in_proc(&tq->tq_queue, nthreads, pri, + proc, "%s", name); return ((taskq_t *)tq); } @@ -191,18 +198,14 @@ taskq_t * taskq_create(const char *name, int nthreads, pri_t pri, int minalloc __unused, int maxalloc __unused, uint_t flags) { - - return (taskq_create_with_init(name, nthreads, pri, minalloc, maxalloc, - flags)); + return (taskq_create_impl(name, nthreads, pri, system_proc, flags)); } taskq_t * -taskq_create_proc(const char *name, int nthreads, pri_t pri, int minalloc, - int maxalloc, proc_t *proc __unused, uint_t flags) +taskq_create_proc(const char *name, int nthreads, pri_t pri, + int minalloc __unused, int maxalloc __unused, proc_t *proc, uint_t flags) { - - return (taskq_create_with_init(name, nthreads, pri, minalloc, maxalloc, - flags)); + return (taskq_create_impl(name, nthreads, pri, proc, flags)); } void diff --git a/module/os/freebsd/zfs/zvol_os.c b/module/os/freebsd/zfs/zvol_os.c index bb3fe3435..113733a5c 100644 --- a/module/os/freebsd/zfs/zvol_os.c +++ b/module/os/freebsd/zfs/zvol_os.c @@ -60,6 +60,7 @@ #include <sys/conf.h> #include <sys/cmn_err.h> #include <sys/stat.h> +#include <sys/proc.h> #include <sys/zap.h> #include <sys/spa.h> #include <sys/spa_impl.h> @@ -135,8 +136,6 @@ struct zvol_state_os { } _zso_state; }; -struct proc *zfsproc; - static uint32_t zvol_minors; SYSCTL_DECL(_vfs_zfs); @@ -385,7 +384,7 @@ zvol_geom_run(zvol_state_t *zv) g_error_provider(pp, 0); - kproc_kthread_add(zvol_geom_worker, zv, &zfsproc, NULL, 0, 0, + kproc_kthread_add(zvol_geom_worker, zv, &system_proc, NULL, 0, 0, "zfskern", "zvol %s", pp->name + sizeof (ZVOL_DRIVER)); } |