git: cc1ec77231d3 - main - Adjust g_waitidle() visibility and definition
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 02 Aug 2022 18:12:18 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=cc1ec77231d3caa4a46fd39b0b08afab6f2e687e
commit cc1ec77231d3caa4a46fd39b0b08afab6f2e687e
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-07-22 08:00:18 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-08-02 18:11:10 +0000
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
---
sys/geom/geom.h | 2 ++
sys/geom/geom_event.c | 8 ++++----
sys/kern/vfs_mountroot.c | 8 +++++---
sys/sys/systm.h | 1 -
4 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/sys/geom/geom.h b/sys/geom/geom.h
index a9990f669863..fa7cacc25f54 100644
--- a/sys/geom/geom.h
+++ b/sys/geom/geom.h
@@ -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);
diff --git a/sys/geom/geom_event.c b/sys/geom/geom_event.c
index f14dfbe1cb54..824fe336fe14 100644
--- a/sys/geom/geom_event.c
+++ b/sys/geom/geom_event.c
@@ -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
diff --git a/sys/kern/vfs_mountroot.c b/sys/kern/vfs_mountroot.c
index ddc9784109b7..1cf5efb6e57e 100644
--- a/sys/kern/vfs_mountroot.c
+++ b/sys/kern/vfs_mountroot.c
@@ -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);
diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index e4d7a949945d..52ee592e9e4a 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -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);