mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-08 20:26:31 +00:00
geom_stripe: Cascade cantrim just like we do for gmirror
If any of the disks can support trim, cascade that up the stack. Otherwise, trims won't pass through striped raid setups. PR: 277673 Reviewed by: imp (minor style tweaks from bug report)
This commit is contained in:
parent
12117d0e93
commit
ea2d874cca
|
@ -591,7 +591,12 @@ g_stripe_start(struct bio *bp)
|
|||
g_stripe_pushdown(sc, bp);
|
||||
return;
|
||||
case BIO_GETATTR:
|
||||
/* To which provider it should be delivered? */
|
||||
if (!strcmp(bp->bio_attribute, "GEOM::candelete")) {
|
||||
int val = (sc->sc_flags & G_STRIPE_FLAG_CANDELETE) != 0;
|
||||
g_handleattr(bp, "GEOM::candelete", &val, sizeof(val));
|
||||
return;
|
||||
}
|
||||
/* otherwise: To which provider it should be delivered? */
|
||||
default:
|
||||
g_io_deliver(bp, EOPNOTSUPP);
|
||||
return;
|
||||
|
@ -794,6 +799,20 @@ g_stripe_add_disk(struct g_stripe_softc *sc, struct g_provider *pp, u_int no)
|
|||
}
|
||||
|
||||
sc->sc_disks[no] = cp;
|
||||
|
||||
/* cascade candelete */
|
||||
error = g_access(cp, 1, 0, 0);
|
||||
if (error == 0) {
|
||||
int can_delete;
|
||||
|
||||
error = g_getattr("GEOM::candelete", cp, &can_delete);
|
||||
if (error == 0 && can_delete != 0)
|
||||
sc->sc_flags |= G_STRIPE_FLAG_CANDELETE;
|
||||
G_STRIPE_DEBUG(1, "Provider %s candelete %i.", pp->name,
|
||||
can_delete);
|
||||
g_access(cp, -1, 0, 0);
|
||||
}
|
||||
|
||||
G_STRIPE_DEBUG(0, "Disk %s attached to %s.", pp->name, sc->sc_name);
|
||||
g_stripe_check_and_run(sc);
|
||||
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
#define G_STRIPE_TYPE_MANUAL 0
|
||||
#define G_STRIPE_TYPE_AUTOMATIC 1
|
||||
|
||||
#define G_STRIPE_FLAG_CANDELETE 0x00000001UL
|
||||
|
||||
#define G_STRIPE_DEBUG(lvl, ...) \
|
||||
_GEOM_DEBUG("GEOM_STRIPE", g_stripe_debug, (lvl), NULL, __VA_ARGS__)
|
||||
#define G_STRIPE_LOGREQ(bp, ...) \
|
||||
|
@ -62,6 +64,7 @@ struct g_stripe_softc {
|
|||
off_t sc_stripesize;
|
||||
uint32_t sc_stripebits;
|
||||
struct mtx sc_lock;
|
||||
int sc_flags;
|
||||
};
|
||||
#define sc_name sc_geom->name
|
||||
#endif /* _KERNEL */
|
||||
|
|
Loading…
Reference in New Issue
Block a user