Changeset View
Changeset View
Standalone View
Standalone View
sys/geom/geom_vfs.c
| Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | |||||
| */ | */ | ||||
| #include <sys/buf.h> | #include <sys/buf.h> | ||||
| struct g_vfs_softc { | struct g_vfs_softc { | ||||
| struct mtx sc_mtx; | struct mtx sc_mtx; | ||||
| struct bufobj *sc_bo; | struct bufobj *sc_bo; | ||||
| struct g_event *sc_event; | struct g_event *sc_event; | ||||
| int sc_active; | int sc_active; | ||||
| int sc_orphaned; | bool sc_orphaned; | ||||
| int sc_enxio_active; | int sc_enxio_active; | ||||
| }; | }; | ||||
| static struct buf_ops __g_vfs_bufops = { | static struct buf_ops __g_vfs_bufops = { | ||||
| .bop_name = "GEOM_VFS", | .bop_name = "GEOM_VFS", | ||||
| .bop_write = bufwrite, | .bop_write = bufwrite, | ||||
| .bop_strategy = g_vfs_strategy, | .bop_strategy = g_vfs_strategy, | ||||
| .bop_sync = bufsync, | .bop_sync = bufsync, | ||||
| ▲ Show 20 Lines • Show All 161 Lines • ▼ Show 20 Lines | g_vfs_orphan(struct g_consumer *cp) | ||||
| gp = cp->geom; | gp = cp->geom; | ||||
| g_trace(G_T_TOPOLOGY, "g_vfs_orphan(%p(%s))", cp, gp->name); | g_trace(G_T_TOPOLOGY, "g_vfs_orphan(%p(%s))", cp, gp->name); | ||||
| sc = gp->softc; | sc = gp->softc; | ||||
| if (sc == NULL) | if (sc == NULL) | ||||
| return; | return; | ||||
| event = g_alloc_event(M_WAITOK); | event = g_alloc_event(M_WAITOK); | ||||
| mtx_lock(&sc->sc_mtx); | mtx_lock(&sc->sc_mtx); | ||||
| KASSERT(sc->sc_event == NULL, ("g_vfs %p already has an event", sc)); | KASSERT(sc->sc_event == NULL, ("g_vfs %p already has an event", sc)); | ||||
| sc->sc_orphaned = 1; | sc->sc_orphaned = true; | ||||
| destroy = (sc->sc_active == 0); | destroy = (sc->sc_active == 0); | ||||
| if (!destroy) { | if (!destroy) { | ||||
| sc->sc_event = event; | sc->sc_event = event; | ||||
| event = NULL; | event = NULL; | ||||
| } | } | ||||
| mtx_unlock(&sc->sc_mtx); | mtx_unlock(&sc->sc_mtx); | ||||
| if (destroy) { | if (destroy) { | ||||
| g_free(event); | g_free(event); | ||||
| ▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines | |||||