diff options
-rw-r--r-- | include/os/freebsd/spl/sys/proc.h | 11 | ||||
-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 |
4 files changed, 27 insertions, 19 deletions
diff --git a/include/os/freebsd/spl/sys/proc.h b/include/os/freebsd/spl/sys/proc.h index e52d37593..a455cfbab 100644 --- a/include/os/freebsd/spl/sys/proc.h +++ b/include/os/freebsd/spl/sys/proc.h @@ -61,13 +61,14 @@ typedef struct thread kthread_t; typedef struct thread *kthread_id_t; typedef struct proc proc_t; -extern struct proc *zfsproc; +extern proc_t *system_proc; static __inline kthread_t * do_thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg, size_t len, proc_t *pp, int state, pri_t pri, const char *name) { kthread_t *td = NULL; + proc_t **ppp; int error; /* @@ -77,8 +78,12 @@ do_thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg, ASSERT(len == 0); ASSERT(state == TS_RUN); - error = kproc_kthread_add(proc, arg, &zfsproc, &td, - RFSTOPPED, stksize / PAGE_SIZE, "zfskern", "%s", name); + if (pp == &p0) + ppp = &system_proc; + else + ppp = &pp; + error = kproc_kthread_add(proc, arg, ppp, &td, RFSTOPPED, + stksize / PAGE_SIZE, "zfskern", "%s", name); if (error == 0) { thread_lock(td); sched_prio(td, pri); 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)); } |