Changeset View
Changeset View
Standalone View
Standalone View
sys/geom/stripe/g_stripe.c
Show All 33 Lines | |||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/module.h> | #include <sys/module.h> | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/bio.h> | #include <sys/bio.h> | ||||
#include <sys/sbuf.h> | #include <sys/sbuf.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/unistd.h> | |||||
#include <vm/uma.h> | #include <vm/uma.h> | ||||
#include <geom/geom.h> | #include <geom/geom.h> | ||||
#include <geom/stripe/g_stripe.h> | #include <geom/stripe/g_stripe.h> | ||||
FEATURE(geom_stripe, "GEOM striping support"); | FEATURE(geom_stripe, "GEOM striping support"); | ||||
static MALLOC_DEFINE(M_STRIPE, "stripe_data", "GEOM_STRIPE Data"); | static MALLOC_DEFINE(M_STRIPE, "stripe_data", "GEOM_STRIPE Data"); | ||||
▲ Show 20 Lines • Show All 514 Lines • ▼ Show 20 Lines | for (cbp = bioq_first(&queue); cbp != NULL; cbp = bioq_first(&queue)) { | ||||
G_STRIPE_LOGREQ(cbp, "Sending request."); | G_STRIPE_LOGREQ(cbp, "Sending request."); | ||||
cp = cbp->bio_caller2; | cp = cbp->bio_caller2; | ||||
cbp->bio_caller2 = NULL; | cbp->bio_caller2 = NULL; | ||||
g_io_request(cbp, cp); | g_io_request(cbp, cp); | ||||
} | } | ||||
} | } | ||||
static void | static void | ||||
g_stripe_media(struct bio *bp) | |||||
{ | |||||
struct g_stripe_softc *sc; | |||||
struct bio *cbp; | |||||
u_int no; | |||||
atomic_set_long((long *)bp->bio_data, _PC_MEDIA_STRIPE); | |||||
sc = bp->bio_to->geom->softc; | |||||
for (no = 0; no < sc->sc_ndisks; no++) { | |||||
cbp = g_clone_bio(bp); | |||||
if (cbp == NULL) { | |||||
g_io_deliver(bp, ENOMEM); | |||||
return; | |||||
} | |||||
cbp->bio_done = g_std_done; | |||||
g_io_request(cbp, sc->sc_disks[no]); | |||||
} | |||||
} | |||||
static void | |||||
g_stripe_start(struct bio *bp) | g_stripe_start(struct bio *bp) | ||||
{ | { | ||||
off_t offset, start, length, nstripe; | off_t offset, start, length, nstripe; | ||||
struct g_stripe_softc *sc; | struct g_stripe_softc *sc; | ||||
u_int no, stripesize; | u_int no, stripesize; | ||||
int error, fast = 0; | int error, fast = 0; | ||||
sc = bp->bio_to->geom->softc; | sc = bp->bio_to->geom->softc; | ||||
Show All 11 Lines | g_stripe_start(struct bio *bp) | ||||
case BIO_READ: | case BIO_READ: | ||||
case BIO_WRITE: | case BIO_WRITE: | ||||
case BIO_DELETE: | case BIO_DELETE: | ||||
break; | break; | ||||
case BIO_FLUSH: | case BIO_FLUSH: | ||||
g_stripe_flush(sc, bp); | g_stripe_flush(sc, bp); | ||||
return; | return; | ||||
case BIO_GETATTR: | case BIO_GETATTR: | ||||
if (strcmp("GEOM::media", bp->bio_attribute) == 0) { | |||||
g_stripe_media(bp); | |||||
return; | |||||
} | |||||
/* To which provider it should be delivered? */ | /* To which provider it should be delivered? */ | ||||
default: | default: | ||||
g_io_deliver(bp, EOPNOTSUPP); | g_io_deliver(bp, EOPNOTSUPP); | ||||
return; | return; | ||||
} | } | ||||
stripesize = sc->sc_stripesize; | stripesize = sc->sc_stripesize; | ||||
▲ Show 20 Lines • Show All 667 Lines • Show Last 20 Lines |