summaryrefslogtreecommitdiffstats
path: root/sys/geom/stripe
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2006-10-31 21:23:51 +0000
committerpjd <pjd@FreeBSD.org>2006-10-31 21:23:51 +0000
commitc33849dc41d24ae1362682bce0b8ebce43af556a (patch)
treee1cf58f0328589a697dacbff3b7e0c1982735a33 /sys/geom/stripe
parent51fb042070317c283395fd7170157adbbc879898 (diff)
downloadFreeBSD-src-c33849dc41d24ae1362682bce0b8ebce43af556a.zip
FreeBSD-src-c33849dc41d24ae1362682bce0b8ebce43af556a.tar.gz
Implement BIO_FLUSH handling by simply passing it down to the components.
Sponsored by: home.pl
Diffstat (limited to 'sys/geom/stripe')
-rw-r--r--sys/geom/stripe/g_stripe.c42
1 files changed, 39 insertions, 3 deletions
diff --git a/sys/geom/stripe/g_stripe.c b/sys/geom/stripe/g_stripe.c
index 4f99ba4..8f8de35 100644
--- a/sys/geom/stripe/g_stripe.c
+++ b/sys/geom/stripe/g_stripe.c
@@ -520,6 +520,42 @@ failure:
}
static void
+g_stripe_flush(struct g_stripe_softc *sc, struct bio *bp)
+{
+ struct bio_queue_head queue;
+ struct g_consumer *cp;
+ struct bio *cbp;
+ u_int no;
+
+ bioq_init(&queue);
+ for (no = 0; no < sc->sc_ndisks; no++) {
+ cbp = g_clone_bio(bp);
+ if (cbp == NULL) {
+ for (cbp = bioq_first(&queue); cbp != NULL;
+ cbp = bioq_first(&queue)) {
+ bioq_remove(&queue, cbp);
+ g_destroy_bio(cbp);
+ }
+ if (bp->bio_error == 0)
+ bp->bio_error = ENOMEM;
+ g_io_deliver(bp, bp->bio_error);
+ return;
+ }
+ bioq_insert_tail(&queue, cbp);
+ cbp->bio_done = g_std_done;
+ cbp->bio_caller1 = sc->sc_disks[no];
+ cbp->bio_to = sc->sc_disks[no]->provider;
+ }
+ for (cbp = bioq_first(&queue); cbp != NULL; cbp = bioq_first(&queue)) {
+ bioq_remove(&queue, cbp);
+ G_STRIPE_LOGREQ(cbp, "Sending request.");
+ cp = cbp->bio_caller1;
+ cbp->bio_caller1 = NULL;
+ g_io_request(cbp, cp);
+ }
+}
+
+static void
g_stripe_start(struct bio *bp)
{
off_t offset, start, length, nstripe;
@@ -542,10 +578,10 @@ g_stripe_start(struct bio *bp)
case BIO_READ:
case BIO_WRITE:
case BIO_DELETE:
- /*
- * Only those requests are supported.
- */
break;
+ case BIO_FLUSH:
+ g_stripe_flush(sc, bp);
+ return;
case BIO_GETATTR:
/* To which provider it should be delivered? */
default:
OpenPOWER on IntegriCloud