Pass BIO_SPEEDUP through all the geom layers
While some geom layers pass unknown commands down, not all do. For the ones that don't, pass BIO_SPEEDUP down to the providers that constittue the geom, as applicable. No changes to vinum or virstor because I was unsure how to add this support, and I'm also unsure how to test these. gvinum doesn't implement BIO_FLUSH either, so it may just be poorly maintained. gvirstor is for testing and not supportig BIO_SPEEDUP is fine. Reviewed by: chs Differential Revision: https://reviews.freebsd.org/D23183
This commit is contained in:
parent
6fa9e6bb14
commit
4aee421586
@ -279,8 +279,11 @@ g_concat_done(struct bio *bp)
|
||||
g_destroy_bio(bp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Called for both BIO_FLUSH and BIO_SPEEDUP. Just pass the call down
|
||||
*/
|
||||
static void
|
||||
g_concat_flush(struct g_concat_softc *sc, struct bio *bp)
|
||||
g_concat_passdown(struct g_concat_softc *sc, struct bio *bp)
|
||||
{
|
||||
struct bio_queue_head queue;
|
||||
struct g_consumer *cp;
|
||||
@ -340,8 +343,9 @@ g_concat_start(struct bio *bp)
|
||||
case BIO_WRITE:
|
||||
case BIO_DELETE:
|
||||
break;
|
||||
case BIO_SPEEDUP:
|
||||
case BIO_FLUSH:
|
||||
g_concat_flush(sc, bp);
|
||||
g_concat_passdown(sc, bp);
|
||||
return;
|
||||
case BIO_GETATTR:
|
||||
if (strcmp("GEOM::kerneldump", bp->bio_attribute) == 0) {
|
||||
|
@ -429,6 +429,7 @@ g_eli_start(struct bio *bp)
|
||||
case BIO_GETATTR:
|
||||
case BIO_FLUSH:
|
||||
case BIO_ZONE:
|
||||
case BIO_SPEEDUP:
|
||||
break;
|
||||
case BIO_DELETE:
|
||||
/*
|
||||
@ -468,6 +469,7 @@ g_eli_start(struct bio *bp)
|
||||
case BIO_GETATTR:
|
||||
case BIO_FLUSH:
|
||||
case BIO_DELETE:
|
||||
case BIO_SPEEDUP:
|
||||
case BIO_ZONE:
|
||||
if (bp->bio_cmd == BIO_GETATTR)
|
||||
cbp->bio_done = g_eli_getattr_done;
|
||||
|
@ -285,6 +285,7 @@ g_gate_start(struct bio *pbp)
|
||||
case BIO_DELETE:
|
||||
case BIO_WRITE:
|
||||
case BIO_FLUSH:
|
||||
case BIO_SPEEDUP:
|
||||
/* XXX: Hack to allow read-only mounts. */
|
||||
if ((sc->sc_flags & G_GATE_FLAG_READONLY) != 0) {
|
||||
g_io_deliver(pbp, EPERM);
|
||||
@ -871,6 +872,7 @@ g_gate_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct threa
|
||||
case BIO_READ:
|
||||
case BIO_DELETE:
|
||||
case BIO_FLUSH:
|
||||
case BIO_SPEEDUP:
|
||||
break;
|
||||
case BIO_WRITE:
|
||||
error = copyout(bp->bio_data, ggio->gctl_data,
|
||||
@ -935,6 +937,7 @@ g_gate_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct threa
|
||||
case BIO_DELETE:
|
||||
case BIO_WRITE:
|
||||
case BIO_FLUSH:
|
||||
case BIO_SPEEDUP:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -560,6 +560,17 @@ g_disk_start(struct bio *bp)
|
||||
devstat_start_transaction_bio(dp->d_devstat, bp2);
|
||||
dp->d_strategy(bp2);
|
||||
break;
|
||||
case BIO_SPEEDUP:
|
||||
bp2 = g_clone_bio(bp);
|
||||
if (bp2 == NULL) {
|
||||
g_io_deliver(bp, ENOMEM);
|
||||
return;
|
||||
}
|
||||
bp2->bio_done = g_disk_done;
|
||||
bp2->bio_caller1 = sc;
|
||||
bp2->bio_disk = dp;
|
||||
dp->d_strategy(bp2);
|
||||
break;
|
||||
default:
|
||||
error = EOPNOTSUPP;
|
||||
break;
|
||||
|
@ -407,6 +407,7 @@ g_io_check(struct bio *bp)
|
||||
break;
|
||||
case BIO_WRITE:
|
||||
case BIO_DELETE:
|
||||
case BIO_SPEEDUP:
|
||||
case BIO_FLUSH:
|
||||
if (cp->acw == 0)
|
||||
return (EPERM);
|
||||
|
@ -312,6 +312,7 @@ g_slice_start(struct bio *bp)
|
||||
/* now, pass it on downwards... */
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case BIO_SPEEDUP:
|
||||
case BIO_FLUSH:
|
||||
bp2 = g_clone_bio(bp);
|
||||
if (bp2 == NULL) {
|
||||
|
@ -746,6 +746,7 @@ g_journal_start(struct bio *bp)
|
||||
return;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case BIO_SPEEDUP:
|
||||
case BIO_DELETE:
|
||||
default:
|
||||
g_io_deliver(bp, EOPNOTSUPP);
|
||||
|
@ -215,6 +215,10 @@ g_llvm_start(struct bio *bp)
|
||||
/* XXX BIO_GETATTR allowed? */
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* BIO_SPEEDUP and BIO_FLUSH should pass through to all sg
|
||||
* elements, but aren't.
|
||||
*/
|
||||
g_io_deliver(bp, EOPNOTSUPP);
|
||||
return;
|
||||
}
|
||||
|
@ -925,7 +925,8 @@ g_mirror_regular_request_error(struct g_mirror_softc *sc,
|
||||
struct g_mirror_disk *disk, struct bio *bp)
|
||||
{
|
||||
|
||||
if (bp->bio_cmd == BIO_FLUSH && bp->bio_error == EOPNOTSUPP)
|
||||
if ((bp->bio_cmd == BIO_FLUSH || bp->bio_cmd == BIO_SPEEDUP) &&
|
||||
bp->bio_error == EOPNOTSUPP)
|
||||
return;
|
||||
|
||||
if ((disk->d_flags & G_MIRROR_DISK_FLAG_BROKEN) == 0) {
|
||||
@ -988,6 +989,10 @@ g_mirror_regular_request(struct g_mirror_softc *sc, struct bio *bp)
|
||||
KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_regular_request_flush,
|
||||
bp->bio_error);
|
||||
break;
|
||||
case BIO_SPEEDUP:
|
||||
KFAIL_POINT_ERROR(DEBUG_FP, g_mirror_regular_request_speedup,
|
||||
bp->bio_error);
|
||||
break;
|
||||
}
|
||||
|
||||
pbp->bio_inbed++;
|
||||
@ -1018,6 +1023,7 @@ g_mirror_regular_request(struct g_mirror_softc *sc, struct bio *bp)
|
||||
case BIO_DELETE:
|
||||
case BIO_WRITE:
|
||||
case BIO_FLUSH:
|
||||
case BIO_SPEEDUP:
|
||||
pbp->bio_inbed--;
|
||||
pbp->bio_children--;
|
||||
break;
|
||||
@ -1043,6 +1049,7 @@ g_mirror_regular_request(struct g_mirror_softc *sc, struct bio *bp)
|
||||
case BIO_DELETE:
|
||||
case BIO_WRITE:
|
||||
case BIO_FLUSH:
|
||||
case BIO_SPEEDUP:
|
||||
if (pbp->bio_children == 0) {
|
||||
/*
|
||||
* All requests failed.
|
||||
@ -1149,6 +1156,7 @@ g_mirror_start(struct bio *bp)
|
||||
case BIO_READ:
|
||||
case BIO_WRITE:
|
||||
case BIO_DELETE:
|
||||
case BIO_SPEEDUP:
|
||||
case BIO_FLUSH:
|
||||
break;
|
||||
case BIO_GETATTR:
|
||||
@ -1783,6 +1791,7 @@ g_mirror_register_request(struct g_mirror_softc *sc, struct bio *bp)
|
||||
*/
|
||||
TAILQ_INSERT_TAIL(&sc->sc_inflight, bp, bio_queue);
|
||||
return;
|
||||
case BIO_SPEEDUP:
|
||||
case BIO_FLUSH:
|
||||
TAILQ_INIT(&queue);
|
||||
LIST_FOREACH(disk, &sc->sc_disks, d_next) {
|
||||
|
@ -255,6 +255,9 @@ g_nop_start(struct bio *bp)
|
||||
case BIO_FLUSH:
|
||||
sc->sc_flushes++;
|
||||
break;
|
||||
case BIO_SPEEDUP:
|
||||
sc->sc_speedups++;
|
||||
break;
|
||||
case BIO_CMD0:
|
||||
sc->sc_cmd0s++;
|
||||
break;
|
||||
@ -438,6 +441,7 @@ g_nop_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp,
|
||||
sc->sc_deletes = 0;
|
||||
sc->sc_getattrs = 0;
|
||||
sc->sc_flushes = 0;
|
||||
sc->sc_speedups = 0;
|
||||
sc->sc_cmd0s = 0;
|
||||
sc->sc_cmd1s = 0;
|
||||
sc->sc_cmd2s = 0;
|
||||
@ -908,6 +912,7 @@ g_nop_ctl_reset(struct gctl_req *req, struct g_class *mp)
|
||||
sc->sc_deletes = 0;
|
||||
sc->sc_getattrs = 0;
|
||||
sc->sc_flushes = 0;
|
||||
sc->sc_speedups = 0;
|
||||
sc->sc_cmd0s = 0;
|
||||
sc->sc_cmd1s = 0;
|
||||
sc->sc_cmd2s = 0;
|
||||
@ -978,6 +983,7 @@ g_nop_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp,
|
||||
sbuf_printf(sb, "%s<Deletes>%ju</Deletes>\n", indent, sc->sc_deletes);
|
||||
sbuf_printf(sb, "%s<Getattrs>%ju</Getattrs>\n", indent, sc->sc_getattrs);
|
||||
sbuf_printf(sb, "%s<Flushes>%ju</Flushes>\n", indent, sc->sc_flushes);
|
||||
sbuf_printf(sb, "%s<Speedups>%ju</Speedups>\n", indent, sc->sc_speedups);
|
||||
sbuf_printf(sb, "%s<Cmd0s>%ju</Cmd0s>\n", indent, sc->sc_cmd0s);
|
||||
sbuf_printf(sb, "%s<Cmd1s>%ju</Cmd1s>\n", indent, sc->sc_cmd1s);
|
||||
sbuf_printf(sb, "%s<Cmd2s>%ju</Cmd2s>\n", indent, sc->sc_cmd2s);
|
||||
|
@ -71,6 +71,7 @@ struct g_nop_softc {
|
||||
uintmax_t sc_cmd0s;
|
||||
uintmax_t sc_cmd1s;
|
||||
uintmax_t sc_cmd2s;
|
||||
uintmax_t sc_speedups;
|
||||
uintmax_t sc_readbytes;
|
||||
uintmax_t sc_wrotebytes;
|
||||
char *sc_physpath;
|
||||
|
@ -2272,6 +2272,7 @@ g_part_start(struct bio *bp)
|
||||
bp2->bio_offset += entry->gpe_offset;
|
||||
g_io_request(bp2, cp);
|
||||
return;
|
||||
case BIO_SPEEDUP:
|
||||
case BIO_FLUSH:
|
||||
break;
|
||||
case BIO_GETATTR:
|
||||
|
@ -1111,6 +1111,7 @@ g_raid_start(struct bio *bp)
|
||||
case BIO_WRITE:
|
||||
case BIO_DELETE:
|
||||
case BIO_FLUSH:
|
||||
case BIO_SPEEDUP:
|
||||
break;
|
||||
case BIO_GETATTR:
|
||||
if (!strcmp(bp->bio_attribute, "GEOM::candelete"))
|
||||
|
@ -224,7 +224,7 @@ g_raid_tr_iostart_concat(struct g_raid_tr_object *tr, struct bio *bp)
|
||||
g_raid_iodone(bp, EIO);
|
||||
return;
|
||||
}
|
||||
if (bp->bio_cmd == BIO_FLUSH) {
|
||||
if (bp->bio_cmd == BIO_FLUSH || bp->bio_cmd == BIO_SPEEDUP) {
|
||||
g_raid_tr_flush_common(tr, bp);
|
||||
return;
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ g_raid_tr_iostart_raid0(struct g_raid_tr_object *tr, struct bio *bp)
|
||||
g_raid_iodone(bp, EIO);
|
||||
return;
|
||||
}
|
||||
if (bp->bio_cmd == BIO_FLUSH) {
|
||||
if (bp->bio_cmd == BIO_FLUSH || bp->bio_cmd == BIO_SPEEDUP) {
|
||||
g_raid_tr_flush_common(tr, bp);
|
||||
return;
|
||||
}
|
||||
|
@ -641,6 +641,7 @@ g_raid_tr_iostart_raid1(struct g_raid_tr_object *tr, struct bio *bp)
|
||||
case BIO_DELETE:
|
||||
g_raid_tr_iostart_raid1_write(tr, bp);
|
||||
break;
|
||||
case BIO_SPEEDUP:
|
||||
case BIO_FLUSH:
|
||||
g_raid_tr_flush_common(tr, bp);
|
||||
break;
|
||||
|
@ -869,6 +869,7 @@ g_raid_tr_iostart_raid1e(struct g_raid_tr_object *tr, struct bio *bp)
|
||||
case BIO_DELETE:
|
||||
g_raid_tr_iostart_raid1e_write(tr, bp);
|
||||
break;
|
||||
case BIO_SPEEDUP:
|
||||
case BIO_FLUSH:
|
||||
g_raid_tr_flush_common(tr, bp);
|
||||
break;
|
||||
|
@ -357,6 +357,7 @@ g_raid_tr_iostart_raid5(struct g_raid_tr_object *tr, struct bio *bp)
|
||||
case BIO_WRITE:
|
||||
case BIO_DELETE:
|
||||
case BIO_FLUSH:
|
||||
case BIO_SPEEDUP:
|
||||
g_raid_iodone(bp, ENODEV);
|
||||
break;
|
||||
default:
|
||||
|
@ -1446,6 +1446,7 @@ g_raid3_start(struct bio *bp)
|
||||
case BIO_WRITE:
|
||||
case BIO_DELETE:
|
||||
break;
|
||||
case BIO_SPEEDUP:
|
||||
case BIO_FLUSH:
|
||||
g_raid3_flush(sc, bp);
|
||||
return;
|
||||
|
@ -316,6 +316,7 @@ g_shsec_start(struct bio *bp)
|
||||
case BIO_READ:
|
||||
case BIO_WRITE:
|
||||
case BIO_FLUSH:
|
||||
case BIO_SPEEDUP:
|
||||
/*
|
||||
* Only those requests are supported.
|
||||
*/
|
||||
|
@ -535,7 +535,7 @@ g_stripe_start_economic(struct bio *bp, u_int no, off_t offset, off_t length)
|
||||
}
|
||||
|
||||
static void
|
||||
g_stripe_flush(struct g_stripe_softc *sc, struct bio *bp)
|
||||
g_stripe_pushdown(struct g_stripe_softc *sc, struct bio *bp)
|
||||
{
|
||||
struct bio_queue_head queue;
|
||||
struct g_consumer *cp;
|
||||
@ -594,8 +594,9 @@ g_stripe_start(struct bio *bp)
|
||||
case BIO_WRITE:
|
||||
case BIO_DELETE:
|
||||
break;
|
||||
case BIO_SPEEDUP:
|
||||
case BIO_FLUSH:
|
||||
g_stripe_flush(sc, bp);
|
||||
g_stripe_pushdown(sc, bp);
|
||||
return;
|
||||
case BIO_GETATTR:
|
||||
/* To which provider it should be delivered? */
|
||||
|
Loading…
Reference in New Issue
Block a user