mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-01-27 10:24:22 +03:00
Upstream: add missing thread_exit()
Undo FreeBSD wrapper for thread_create() added to call thread_exit. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Jorgen Lundman <lundman@lundman.net> Closes #10314
This commit is contained in:
parent
8b240f14f9
commit
eeb8fae9c7
@ -63,28 +63,12 @@ typedef struct proc proc_t;
|
||||
|
||||
extern struct proc *zfsproc;
|
||||
|
||||
struct thread_wrap {
|
||||
void *tw_arg;
|
||||
void (*tw_proc)(void*);
|
||||
};
|
||||
|
||||
static __inline void
|
||||
solthread_wrapper(void *arg)
|
||||
{
|
||||
struct thread_wrap *tw = arg;
|
||||
|
||||
tw->tw_proc(tw->tw_arg);
|
||||
free(tw, M_SOLARIS);
|
||||
kthread_exit();
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
kthread_t *td = NULL;
|
||||
int error;
|
||||
struct thread_wrap *tw;
|
||||
|
||||
/*
|
||||
* Be sure there are no surprises.
|
||||
@ -92,11 +76,8 @@ do_thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg,
|
||||
ASSERT(stk == NULL);
|
||||
ASSERT(len == 0);
|
||||
ASSERT(state == TS_RUN);
|
||||
tw = malloc(sizeof (*tw), M_SOLARIS, M_WAITOK);
|
||||
tw->tw_proc = proc;
|
||||
tw->tw_arg = arg;
|
||||
|
||||
error = kproc_kthread_add(solthread_wrapper, tw, &zfsproc, &td,
|
||||
error = kproc_kthread_add(proc, arg, &zfsproc, &td,
|
||||
RFSTOPPED, stksize / PAGE_SIZE, "zfskern", "solthread %p", proc);
|
||||
if (error == 0) {
|
||||
thread_lock(td);
|
||||
@ -105,8 +86,6 @@ do_thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg,
|
||||
#if __FreeBSD_version < 1300068
|
||||
thread_unlock(td);
|
||||
#endif
|
||||
} else {
|
||||
free(tw, M_SOLARIS);
|
||||
}
|
||||
return (td);
|
||||
}
|
||||
|
@ -1319,6 +1319,8 @@ redact_list_thread(void *arg)
|
||||
record = range_alloc(DATA, 0, 0, 0, B_TRUE);
|
||||
bqueue_enqueue_flush(&rlt_arg->q, record, sizeof (*record));
|
||||
spl_fstrans_unmark(cookie);
|
||||
|
||||
thread_exit();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -558,6 +558,8 @@ vdev_initialize_thread(void *arg)
|
||||
vd->vdev_initialize_thread = NULL;
|
||||
cv_broadcast(&vd->vdev_initialize_cv);
|
||||
mutex_exit(&vd->vdev_initialize_lock);
|
||||
|
||||
thread_exit();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1595,6 +1595,8 @@ spa_vdev_remove_thread(void *arg)
|
||||
ASSERT0(range_tree_space(svr->svr_allocd_segs));
|
||||
vdev_remove_complete(spa);
|
||||
}
|
||||
|
||||
thread_exit();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -896,6 +896,8 @@ vdev_trim_thread(void *arg)
|
||||
vd->vdev_trim_thread = NULL;
|
||||
cv_broadcast(&vd->vdev_trim_cv);
|
||||
mutex_exit(&vd->vdev_trim_lock);
|
||||
|
||||
thread_exit();
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user