Move the three geom kprocs as threads under a single pid.
Reviewed by: julian
This commit is contained in:
parent
73e3bb6563
commit
b2901e999b
@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/bio.h>
|
#include <sys/bio.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#include <sys/proc.h>
|
#include <sys/proc.h>
|
||||||
|
#include <sys/unistd.h>
|
||||||
#include <sys/kthread.h>
|
#include <sys/kthread.h>
|
||||||
#include <sys/lock.h>
|
#include <sys/lock.h>
|
||||||
#include <sys/mutex.h>
|
#include <sys/mutex.h>
|
||||||
@ -57,7 +58,10 @@ MALLOC_DEFINE(M_GEOM, "GEOM", "Geom data structures");
|
|||||||
|
|
||||||
struct sx topology_lock;
|
struct sx topology_lock;
|
||||||
|
|
||||||
static struct proc *g_up_proc;
|
static struct proc *g_proc;
|
||||||
|
static struct thread *g_up_td;
|
||||||
|
static struct thread *g_down_td;
|
||||||
|
static struct thread *g_event_td;
|
||||||
|
|
||||||
int g_debugflags;
|
int g_debugflags;
|
||||||
int g_collectstats = 1;
|
int g_collectstats = 1;
|
||||||
@ -82,71 +86,43 @@ int g_shutdown;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_up_procbody(void)
|
g_up_procbody(void *arg)
|
||||||
{
|
{
|
||||||
struct proc *p = g_up_proc;
|
|
||||||
struct thread *tp = FIRST_THREAD_IN_PROC(p);
|
|
||||||
|
|
||||||
mtx_assert(&Giant, MA_NOTOWNED);
|
mtx_assert(&Giant, MA_NOTOWNED);
|
||||||
thread_lock(tp);
|
thread_lock(g_up_td);
|
||||||
sched_prio(tp, PRIBIO);
|
sched_prio(g_up_td, PRIBIO);
|
||||||
thread_unlock(tp);
|
thread_unlock(g_up_td);
|
||||||
for(;;) {
|
for(;;) {
|
||||||
g_io_schedule_up(tp);
|
g_io_schedule_up(g_up_td);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct kproc_desc g_up_kp = {
|
|
||||||
"g_up",
|
|
||||||
g_up_procbody,
|
|
||||||
&g_up_proc,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct proc *g_down_proc;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_down_procbody(void)
|
g_down_procbody(void *arg)
|
||||||
{
|
{
|
||||||
struct proc *p = g_down_proc;
|
|
||||||
struct thread *tp = FIRST_THREAD_IN_PROC(p);
|
|
||||||
|
|
||||||
mtx_assert(&Giant, MA_NOTOWNED);
|
mtx_assert(&Giant, MA_NOTOWNED);
|
||||||
thread_lock(tp);
|
thread_lock(g_down_td);
|
||||||
sched_prio(tp, PRIBIO);
|
sched_prio(g_down_td, PRIBIO);
|
||||||
thread_unlock(tp);
|
thread_unlock(g_down_td);
|
||||||
for(;;) {
|
for(;;) {
|
||||||
g_io_schedule_down(tp);
|
g_io_schedule_down(g_down_td);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct kproc_desc g_down_kp = {
|
|
||||||
"g_down",
|
|
||||||
g_down_procbody,
|
|
||||||
&g_down_proc,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct proc *g_event_proc;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_event_procbody(void)
|
g_event_procbody(void *arg)
|
||||||
{
|
{
|
||||||
struct proc *p = g_event_proc;
|
|
||||||
struct thread *tp = FIRST_THREAD_IN_PROC(p);
|
|
||||||
|
|
||||||
mtx_assert(&Giant, MA_NOTOWNED);
|
mtx_assert(&Giant, MA_NOTOWNED);
|
||||||
thread_lock(tp);
|
thread_lock(g_event_td);
|
||||||
sched_prio(tp, PRIBIO);
|
sched_prio(g_event_td, PRIBIO);
|
||||||
thread_unlock(tp);
|
thread_unlock(g_event_td);
|
||||||
g_run_events();
|
g_run_events();
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct kproc_desc g_event_kp = {
|
|
||||||
"g_event",
|
|
||||||
g_event_procbody,
|
|
||||||
&g_event_proc,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
geom_shutdown(void *foo __unused)
|
geom_shutdown(void *foo __unused)
|
||||||
{
|
{
|
||||||
@ -164,9 +140,12 @@ g_init(void)
|
|||||||
g_event_init();
|
g_event_init();
|
||||||
g_ctl_init();
|
g_ctl_init();
|
||||||
mtx_lock(&Giant);
|
mtx_lock(&Giant);
|
||||||
kproc_start(&g_event_kp);
|
kproc_kthread_add(g_event_procbody, NULL, &g_proc, &g_event_td,
|
||||||
kproc_start(&g_up_kp);
|
RFHIGHPID, 0, "geom", "g_event");
|
||||||
kproc_start(&g_down_kp);
|
kproc_kthread_add(g_up_procbody, NULL, &g_proc, &g_up_td,
|
||||||
|
RFHIGHPID, 0, "geom", "g_up");
|
||||||
|
kproc_kthread_add(g_down_procbody, NULL, &g_proc, &g_down_td,
|
||||||
|
RFHIGHPID, 0, "geom", "g_down");
|
||||||
mtx_unlock(&Giant);
|
mtx_unlock(&Giant);
|
||||||
EVENTHANDLER_REGISTER(shutdown_pre_sync, geom_shutdown, NULL,
|
EVENTHANDLER_REGISTER(shutdown_pre_sync, geom_shutdown, NULL,
|
||||||
SHUTDOWN_PRI_FIRST);
|
SHUTDOWN_PRI_FIRST);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user