mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-23 11:41:07 +01:00
GEOM: Minor polishing in geom_event.
- Remove timeouts from msleep()'s. Those should always be woken up. - Move wakeup() under the lock to not call on possibly freed pointer. - Remove some dead code. MFC after: 2 weeks
This commit is contained in:
parent
e161dfa918
commit
f4bf48c25c
@ -268,7 +268,6 @@ int g_attr_changed(struct g_provider *pp, const char *attr, int flag);
|
||||
int g_media_changed(struct g_provider *pp, int flag);
|
||||
int g_media_gone(struct g_provider *pp, int flag);
|
||||
void g_orphan_provider(struct g_provider *pp, int error);
|
||||
void g_waitidlelock(void);
|
||||
struct g_event *g_alloc_event(int flag);
|
||||
void g_post_event_ep(g_event_t *func, void *arg, struct g_event *ep, ...);
|
||||
|
||||
|
@ -90,29 +90,12 @@ g_waitidle(void)
|
||||
TSWAIT("GEOM events");
|
||||
while (!TAILQ_EMPTY(&g_events))
|
||||
msleep(&g_pending_events, &g_eventlock, PPAUSE,
|
||||
"g_waitidle", hz/5);
|
||||
"g_waitidle", 0);
|
||||
TSUNWAIT("GEOM events");
|
||||
mtx_unlock(&g_eventlock);
|
||||
curthread->td_pflags &= ~TDP_GEOM;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
g_waitidlelock(void)
|
||||
{
|
||||
|
||||
g_topology_assert();
|
||||
mtx_lock(&g_eventlock);
|
||||
while (!TAILQ_EMPTY(&g_events)) {
|
||||
g_topology_unlock();
|
||||
msleep(&g_pending_events, &g_eventlock, PPAUSE,
|
||||
"g_waitidlel", hz/5);
|
||||
g_topology_lock();
|
||||
}
|
||||
mtx_unlock(&g_eventlock);
|
||||
}
|
||||
#endif
|
||||
|
||||
struct g_attrchanged_args {
|
||||
struct g_provider *pp;
|
||||
const char *attr;
|
||||
@ -254,10 +237,6 @@ one_event(void)
|
||||
wakeup(&g_pending_events);
|
||||
return (0);
|
||||
}
|
||||
if (ep->flag & EV_INPROGRESS) {
|
||||
mtx_unlock(&g_eventlock);
|
||||
return (1);
|
||||
}
|
||||
ep->flag |= EV_INPROGRESS;
|
||||
mtx_unlock(&g_eventlock);
|
||||
g_topology_assert();
|
||||
@ -269,8 +248,8 @@ one_event(void)
|
||||
ep->flag &= ~EV_INPROGRESS;
|
||||
if (ep->flag & EV_WAKEUP) {
|
||||
ep->flag |= EV_DONE;
|
||||
mtx_unlock(&g_eventlock);
|
||||
wakeup(ep);
|
||||
mtx_unlock(&g_eventlock);
|
||||
} else {
|
||||
mtx_unlock(&g_eventlock);
|
||||
g_free(ep);
|
||||
@ -457,7 +436,7 @@ g_waitfor_event(g_event_t *func, void *arg, int flag, ...)
|
||||
|
||||
mtx_lock(&g_eventlock);
|
||||
while (!(ep->flag & EV_DONE))
|
||||
msleep(ep, &g_eventlock, PRIBIO, "g_waitfor_event", hz);
|
||||
msleep(ep, &g_eventlock, PRIBIO, "g_waitfor_event", 0);
|
||||
if (ep->flag & EV_CANCELED)
|
||||
error = EAGAIN;
|
||||
mtx_unlock(&g_eventlock);
|
||||
|
Loading…
Reference in New Issue
Block a user