Adjust g_waitidle() visibility and definition

Explicitly pass the struct thread argument.
Move the function prototype from sys/systm.h to geom/geom.h, we do not
need almost each kernel source to see the prototype, it is now used
only by kern/vfs_mountroot.c outside geom/geom_event.c, where the
function is defined.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D35888
This commit is contained in:
Konstantin Belousov 2022-07-22 11:00:18 +03:00
parent 4fced8642f
commit cc1ec77231
4 changed files with 11 additions and 8 deletions

View File

@ -59,6 +59,7 @@ struct sbuf;
struct gctl_req;
struct g_configargs;
struct disk_zone_args;
struct thread;
typedef int g_config_t (struct g_configargs *ca);
typedef void g_ctl_req_t (struct gctl_req *, struct g_class *cp, char const *verb);
@ -270,6 +271,7 @@ int g_media_gone(struct g_provider *pp, int flag);
void g_orphan_provider(struct g_provider *pp, int error);
struct g_event *g_alloc_event(int flag);
void g_post_event_ep(g_event_t *func, void *arg, struct g_event *ep, ...);
void g_waitidle(struct thread *td);
/* geom_subr.c */
int g_access(struct g_consumer *cp, int nread, int nwrite, int nexcl);

View File

@ -81,7 +81,7 @@ struct g_event {
#define EV_INPROGRESS 0x10000
void
g_waitidle(void)
g_waitidle(struct thread *td)
{
g_topology_assert_not();
@ -93,17 +93,17 @@ g_waitidle(void)
"g_waitidle", 0);
TSUNWAIT("GEOM events");
mtx_unlock(&g_eventlock);
curthread->td_pflags &= ~TDP_GEOM;
td->td_pflags &= ~TDP_GEOM;
}
static void
ast_geom(struct thread *td __unused, int tda __unused)
ast_geom(struct thread *td, int tda __unused)
{
/*
* If this thread tickled GEOM, we need to wait for the giggling to
* stop before we return to userland.
*/
g_waitidle();
g_waitidle(td);
}
static void

View File

@ -978,6 +978,7 @@ static void
vfs_mountroot_wait(void)
{
struct root_hold_token *h;
struct thread *td;
struct timeval lastfail;
int curfail;
@ -986,8 +987,9 @@ vfs_mountroot_wait(void)
curfail = 0;
lastfail.tv_sec = 0;
ppsratecheck(&lastfail, &curfail, 1);
td = curthread;
while (1) {
g_waitidle();
g_waitidle(td);
mtx_lock(&root_holds_mtx);
if (TAILQ_EMPTY(&root_holds)) {
mtx_unlock(&root_holds_mtx);
@ -1004,7 +1006,7 @@ vfs_mountroot_wait(void)
hz);
TSUNWAIT("root mount");
}
g_waitidle();
g_waitidle(td);
TSEXIT();
}
@ -1030,7 +1032,7 @@ vfs_mountroot_wait_if_neccessary(const char *fs, const char *dev)
* Note that we must wait for GEOM to finish reconfiguring itself,
* eg for geom_part(4) to finish tasting.
*/
g_waitidle();
g_waitidle(curthread);
if (parse_mount_dev_present(dev))
return (0);

View File

@ -150,7 +150,6 @@ void *hashinit_flags(int count, struct malloc_type *type,
void *phashinit(int count, struct malloc_type *type, u_long *nentries);
void *phashinit_flags(int count, struct malloc_type *type, u_long *nentries,
int flags);
void g_waitidle(void);
void cpu_flush_dcache(void *, size_t);
void cpu_rootconf(void);