Date: Sun, 23 Aug 2009 11:33:47 +0000 (UTC) From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r196458 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/sys Message-ID: <200908231133.n7NBXl5D059625@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pjd Date: Sun Aug 23 11:33:46 2009 New Revision: 196458 URL: http://svn.freebsd.org/changeset/base/196458 Log: - Hide ZFS kernel threads under zfskern process. - Use better (shorter) threads names: 'zvol:worker zvol/tank/vol00' -> 'zvol tank/vol00' 'vdev:worker da0' -> 'vdev da0' Modified: head/sys/cddl/compat/opensolaris/sys/proc.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c head/sys/cddl/contrib/opensolaris/uts/common/sys/callb.h Modified: head/sys/cddl/compat/opensolaris/sys/proc.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/proc.h Sun Aug 23 11:27:08 2009 (r196457) +++ head/sys/cddl/compat/opensolaris/sys/proc.h Sun Aug 23 11:33:46 2009 (r196458) @@ -57,12 +57,13 @@ typedef struct thread kthread_t; typedef struct thread *kthread_id_t; typedef struct proc proc_t; +extern struct proc *zfsproc; + static __inline kthread_t * thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg, size_t len, proc_t *pp, int state, pri_t pri) { - kthread_t *td; - proc_t *p; + kthread_t *td = NULL; int error; /* @@ -71,13 +72,11 @@ thread_create(caddr_t stk, size_t stksiz ASSERT(stk == NULL); ASSERT(len == 0); ASSERT(state == TS_RUN); + ASSERT(pp == &p0); - error = kproc_create(proc, arg, &p, 0, stksize / PAGE_SIZE, - "solthread %p", proc); - if (error != 0) - td = NULL; - else { - td = FIRST_THREAD_IN_PROC(p); + error = kproc_kthread_add(proc, arg, &zfsproc, &td, 0, + stksize / PAGE_SIZE, "zfskern", "solthread %p", proc); + if (error == 0) { thread_lock(td); sched_prio(td, pri); thread_unlock(td); @@ -85,7 +84,7 @@ thread_create(caddr_t stk, size_t stksiz return (td); } -#define thread_exit() kproc_exit(0) +#define thread_exit() kthread_exit() #endif /* _KERNEL */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Aug 23 11:27:08 2009 (r196457) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Aug 23 11:33:46 2009 (r196458) @@ -207,7 +207,7 @@ vdev_geom_worker(void *arg) ctx->gc_state = 2; wakeup_one(&ctx->gc_state); mtx_unlock(&ctx->gc_queue_mtx); - kproc_exit(0); + kthread_exit(); } msleep(&ctx->gc_queue, &ctx->gc_queue_mtx, PRIBIO | PDROP, "vgeom:io", 0); @@ -534,8 +534,8 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi vd->vdev_tsd = ctx; pp = cp->provider; - kproc_create(vdev_geom_worker, ctx, NULL, 0, 0, "vdev:worker %s", - pp->name); + kproc_kthread_add(vdev_geom_worker, ctx, &zfsproc, NULL, 0, 0, + "zfskern", "vdev %s", pp->name); /* * Determine the actual size of the device. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Aug 23 11:27:08 2009 (r196457) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Aug 23 11:33:46 2009 (r196458) @@ -3057,6 +3057,7 @@ zfsdev_fini(void) } static struct root_hold_token *zfs_root_token; +struct proc *zfsproc; uint_t zfs_fsyncer_key; extern uint_t rrw_tsd_key; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sun Aug 23 11:27:08 2009 (r196457) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sun Aug 23 11:33:46 2009 (r196458) @@ -415,7 +415,7 @@ zvol_worker(void *arg) zv->zv_state = 2; wakeup(&zv->zv_state); mtx_unlock(&zv->zv_queue_mtx); - kproc_exit(0); + kthread_exit(); } msleep(&zv->zv_queue, &zv->zv_queue_mtx, PRIBIO | PDROP, "zvol:io", 0); @@ -828,7 +828,8 @@ zvol_create_minor(const char *name, majo bioq_init(&zv->zv_queue); mtx_init(&zv->zv_queue_mtx, "zvol", NULL, MTX_DEF); zv->zv_state = 0; - kproc_create(zvol_worker, zv, NULL, 0, 0, "zvol:worker %s", pp->name); + kproc_kthread_add(zvol_worker, zv, &zfsproc, NULL, 0, 0, "zfskern", + "zvol %s", pp->name + strlen(ZVOL_DEV_DIR) + 1); zvol_minors++; end: Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/callb.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/callb.h Sun Aug 23 11:27:08 2009 (r196457) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/callb.h Sun Aug 23 11:33:46 2009 (r196458) @@ -135,8 +135,6 @@ typedef struct callb_cpr { #define CALLB_CPR_INIT(cp, lockp, func, name) { \ strlcpy(curthread->td_name, (name), \ sizeof(curthread->td_name)); \ - strlcpy(curthread->td_proc->p_comm, (name), \ - sizeof(curthread->td_proc->p_comm)); \ bzero((caddr_t)(cp), sizeof (callb_cpr_t)); \ (cp)->cc_lockp = lockp; \ (cp)->cc_id = callb_add(func, (void *)(cp), \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908231133.n7NBXl5D059625>