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 is a redo of r357710.
This commit is contained in:
parent
d8a84f08e8
commit
1353215314
@ -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 */
|
||||
|
||||
@ -878,6 +879,7 @@ static int ada_spindown_shutdown = ADA_DEFAULT_SPINDOWN_SHUTDOWN;
|
||||
static int ada_spindown_suspend = ADA_DEFAULT_SPINDOWN_SUSPEND;
|
||||
static int ada_read_ahead = ADA_DEFAULT_READ_AHEAD;
|
||||
static int ada_write_cache = ADA_DEFAULT_WRITE_CACHE;
|
||||
static int ada_enable_biospeedup = 1;
|
||||
|
||||
static SYSCTL_NODE(_kern_cam, OID_AUTO, ada, CTLFLAG_RD, 0,
|
||||
"CAM Direct Access Disk driver");
|
||||
@ -895,6 +897,8 @@ SYSCTL_INT(_kern_cam_ada, OID_AUTO, read_ahead, CTLFLAG_RWTUN,
|
||||
&ada_read_ahead, 0, "Enable disk read-ahead");
|
||||
SYSCTL_INT(_kern_cam_ada, OID_AUTO, write_cache, CTLFLAG_RWTUN,
|
||||
&ada_write_cache, 0, "Enable disk write cache");
|
||||
SYSCTL_INT(_kern_cam_ada, OID_AUTO, enable_biospeedup, CTLFLAG_RDTUN,
|
||||
&ada_enable_biospeedup, 0, "Enable BIO_SPEEDUP processing");
|
||||
|
||||
/*
|
||||
* ADA_ORDEREDTAG_INTERVAL determines how often, relative
|
||||
@ -1566,6 +1570,9 @@ adagetattr(struct bio *bp)
|
||||
int ret;
|
||||
struct cam_periph *periph;
|
||||
|
||||
if (g_handleattr_int(bp, "GEOM::canspeedup", ada_enable_biospeedup))
|
||||
return (EJUSTRETURN);
|
||||
|
||||
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 */
|
||||
|
||||
@ -174,9 +175,12 @@ static SYSCTL_NODE(_kern_cam, OID_AUTO, nda, CTLFLAG_RD, 0,
|
||||
static int nda_send_ordered = NDA_DEFAULT_SEND_ORDERED;
|
||||
static int nda_default_timeout = NDA_DEFAULT_TIMEOUT;
|
||||
static int nda_max_trim_entries = NDA_MAX_TRIM_ENTRIES;
|
||||
static int nda_enable_biospeedup = 1;
|
||||
SYSCTL_INT(_kern_cam_nda, OID_AUTO, max_trim, CTLFLAG_RDTUN,
|
||||
&nda_max_trim_entries, NDA_MAX_TRIM_ENTRIES,
|
||||
"Maximum number of BIO_DELETE to send down as a DSM TRIM.");
|
||||
SYSCTL_INT(_kern_cam_nda, OID_AUTO, enable_biospeedup, CTLFLAG_RDTUN,
|
||||
&nda_enable_biospeedup, 0, "Enable BIO_SPEEDUP processing");
|
||||
|
||||
/*
|
||||
* All NVMe media is non-rotational, so all nvme device instances
|
||||
@ -700,6 +704,9 @@ ndagetattr(struct bio *bp)
|
||||
int ret;
|
||||
struct cam_periph *periph;
|
||||
|
||||
if (g_handleattr_int(bp, "GEOM::canspeedup", nda_enable_biospeedup))
|
||||
return (EJUSTRETURN);
|
||||
|
||||
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,
|
||||
|
@ -1547,6 +1547,7 @@ static int da_default_timeout = DA_DEFAULT_TIMEOUT;
|
||||
static sbintime_t da_default_softtimeout = DA_DEFAULT_SOFTTIMEOUT;
|
||||
static int da_send_ordered = DA_DEFAULT_SEND_ORDERED;
|
||||
static int da_disable_wp_detection = 0;
|
||||
static int da_enable_biospeedup = 1;
|
||||
|
||||
static SYSCTL_NODE(_kern_cam, OID_AUTO, da, CTLFLAG_RD, 0,
|
||||
"CAM Direct Access Disk driver");
|
||||
@ -1561,6 +1562,8 @@ SYSCTL_INT(_kern_cam_da, OID_AUTO, send_ordered, CTLFLAG_RWTUN,
|
||||
SYSCTL_INT(_kern_cam_da, OID_AUTO, disable_wp_detection, CTLFLAG_RWTUN,
|
||||
&da_disable_wp_detection, 0,
|
||||
"Disable detection of write-protected disks");
|
||||
SYSCTL_INT(_kern_cam_da, OID_AUTO, enable_biospeedup, CTLFLAG_RDTUN,
|
||||
&da_enable_biospeedup, 0, "Enable BIO_SPEEDUP processing");
|
||||
|
||||
SYSCTL_PROC(_kern_cam_da, OID_AUTO, default_softtimeout,
|
||||
CTLTYPE_UINT | CTLFLAG_RW, NULL, 0, dasysctlsofttimeout, "I",
|
||||
@ -1967,6 +1970,9 @@ dagetattr(struct bio *bp)
|
||||
int ret;
|
||||
struct cam_periph *periph;
|
||||
|
||||
if (g_handleattr_int(bp, "GEOM::canspeedup", da_enable_biospeedup))
|
||||
return (EJUSTRETURN);
|
||||
|
||||
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,12 @@ ffs_mountfs(devvp, mp, td)
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -131,6 +131,7 @@ struct ufsmount {
|
||||
*/
|
||||
#define UM_CANDELETE 0x00000001 /* devvp supports TRIM */
|
||||
#define UM_WRITESUSPENDED 0x00000002 /* suspension in progress */
|
||||
#define UM_CANSPEEDUP 0x00000004 /* devvp supports SPEEDUP */
|
||||
|
||||
/*
|
||||
* function prototypes
|
||||
|
Loading…
Reference in New Issue
Block a user