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; | ||||
int sc_active; | int sc_active; | ||||
int sc_orphaned; | int sc_orphaned; | ||||
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, | ||||
.bop_bdflush = bufbdflush | .bop_bdflush = bufbdflush | ||||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | if (mp != NULL) { | ||||
mp->mnt_stat.f_syncwrites++; | mp->mnt_stat.f_syncwrites++; | ||||
} | } | ||||
} | } | ||||
VI_UNLOCK(vp); | VI_UNLOCK(vp); | ||||
} | } | ||||
cp = bip->bio_from; | cp = bip->bio_from; | ||||
sc = cp->geom->softc; | sc = cp->geom->softc; | ||||
if (bip->bio_error && bip->bio_error != EOPNOTSUPP) | if (bip->bio_error != 0 && bip->bio_error != EOPNOTSUPP) { | ||||
if ((bp->b_xflags & BX_CVTENXIO) != 0) | |||||
sc->sc_enxio_active = 1; | |||||
if (sc->sc_enxio_active) | |||||
bip->bio_error = ENXIO; | |||||
g_print_bio("g_vfs_done():", bip, "error = %d", | g_print_bio("g_vfs_done():", bip, "error = %d", | ||||
bip->bio_error); | bip->bio_error); | ||||
} | |||||
bp->b_error = bip->bio_error; | bp->b_error = bip->bio_error; | ||||
bp->b_ioflags = bip->bio_flags; | bp->b_ioflags = bip->bio_flags; | ||||
if (bip->bio_error) | if (bip->bio_error) | ||||
bp->b_ioflags |= BIO_ERROR; | bp->b_ioflags |= BIO_ERROR; | ||||
bp->b_resid = bp->b_bcount - bip->bio_completed; | bp->b_resid = bp->b_bcount - bip->bio_completed; | ||||
g_destroy_bio(bip); | g_destroy_bio(bip); | ||||
mtx_lock(&sc->sc_mtx); | mtx_lock(&sc->sc_mtx); | ||||
Show All 14 Lines | g_vfs_strategy(struct bufobj *bo, struct buf *bp) | ||||
cp = bo->bo_private; | cp = bo->bo_private; | ||||
sc = cp->geom->softc; | sc = cp->geom->softc; | ||||
/* | /* | ||||
* If the provider has orphaned us, just return ENXIO. | * If the provider has orphaned us, just return ENXIO. | ||||
*/ | */ | ||||
mtx_lock(&sc->sc_mtx); | mtx_lock(&sc->sc_mtx); | ||||
if (sc->sc_orphaned) { | if (sc->sc_orphaned || sc->sc_enxio_active) { | ||||
mtx_unlock(&sc->sc_mtx); | mtx_unlock(&sc->sc_mtx); | ||||
bp->b_error = ENXIO; | bp->b_error = ENXIO; | ||||
bp->b_ioflags |= BIO_ERROR; | bp->b_ioflags |= BIO_ERROR; | ||||
bufdone(bp); | bufdone(bp); | ||||
return; | return; | ||||
} | } | ||||
sc->sc_active++; | sc->sc_active++; | ||||
mtx_unlock(&sc->sc_mtx); | mtx_unlock(&sc->sc_mtx); | ||||
▲ Show 20 Lines • Show All 108 Lines • Show Last 20 Lines |