Add rudamentary support for UFS to probe whether a block device supports the
BIO_SPEEDUP command. Add complimentary support to the CAM periphs that support it.
This commit is contained in:
parent
39c614c6b7
commit
7d99bda79e
@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/proc.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <geom/geom.h>
|
||||
#include <geom/geom_disk.h>
|
||||
#endif /* _KERNEL */
|
||||
|
||||
@ -1566,6 +1567,10 @@ adagetattr(struct bio *bp)
|
||||
int ret;
|
||||
struct cam_periph *periph;
|
||||
|
||||
/* TODO: tunable knob */
|
||||
if (g_handleattr_int(bp, "GEOM::canspeedup", 1))
|
||||
return (0);
|
||||
|
||||
periph = (struct cam_periph *)bp->bio_disk->d_drv1;
|
||||
cam_periph_lock(periph);
|
||||
ret = xpt_getattr(bp->bio_data, bp->bio_length, bp->bio_attribute,
|
||||
|
@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/cons.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <geom/geom.h>
|
||||
#include <geom/geom_disk.h>
|
||||
#endif /* _KERNEL */
|
||||
|
||||
@ -700,6 +701,10 @@ ndagetattr(struct bio *bp)
|
||||
int ret;
|
||||
struct cam_periph *periph;
|
||||
|
||||
/* TODO: tunable knob */
|
||||
if (g_handleattr_int(bp, "GEOM::canspeedup", 1))
|
||||
return (0);
|
||||
|
||||
periph = (struct cam_periph *)bp->bio_disk->d_drv1;
|
||||
cam_periph_lock(periph);
|
||||
ret = xpt_getattr(bp->bio_data, bp->bio_length, bp->bio_attribute,
|
||||
|
@ -1942,6 +1942,10 @@ dagetattr(struct bio *bp)
|
||||
int ret;
|
||||
struct cam_periph *periph;
|
||||
|
||||
/* TODO: tunable knob for this */
|
||||
if (g_handleattr_int(bp, "GEOM::canspeedup", 1))
|
||||
return (0);
|
||||
|
||||
periph = (struct cam_periph *)bp->bio_disk->d_drv1;
|
||||
cam_periph_lock(periph);
|
||||
ret = xpt_getattr(bp->bio_data, bp->bio_length, bp->bio_attribute,
|
||||
|
@ -1464,6 +1464,9 @@ softdep_send_speedup(struct ufsmount *ump, size_t shortage, u_int flags)
|
||||
{
|
||||
struct buf *bp;
|
||||
|
||||
if ((ump->um_flags & UM_CANSPEEDUP) == 0)
|
||||
return;
|
||||
|
||||
bp = malloc(sizeof(*bp), M_TRIM, M_WAITOK | M_ZERO);
|
||||
bp->b_iocmd = BIO_SPEEDUP;
|
||||
bp->b_ioflags = flags;
|
||||
|
@ -794,7 +794,7 @@ ffs_mountfs(devvp, mp, td)
|
||||
struct ucred *cred;
|
||||
struct g_consumer *cp;
|
||||
struct mount *nmp;
|
||||
int candelete;
|
||||
int candelete, canspeedup;
|
||||
off_t loc;
|
||||
|
||||
fs = NULL;
|
||||
@ -1011,6 +1011,13 @@ ffs_mountfs(devvp, mp, td)
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: sysctl tunables, runtime modification */
|
||||
len = sizeof(int);
|
||||
if (g_io_getattr("GEOM::canspeedup", cp, &len, &canspeedup) == 0) {
|
||||
if (canspeedup)
|
||||
ump->um_flags |= UM_CANSPEEDUP;
|
||||
}
|
||||
|
||||
ump->um_mountp = mp;
|
||||
ump->um_dev = dev;
|
||||
ump->um_devvp = devvp;
|
||||
|
Loading…
x
Reference in New Issue
Block a user