diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2011-07-12 00:41:44 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2011-07-12 00:41:44 +0000 |
commit | c7eaade23a26bb6bc680a8bec5df9a843cdc7310 (patch) | |
tree | 9ca8109e0b2c740193b9f76d86848322f2ffa46f /sys | |
parent | 940c873c47bd660d38bca0dec6ddad48fac3745a (diff) |
now that we know if a disk is thin provisioned (or an ssd), we can choose
to use the fifo bufq sorting on such disks. there's no point ordering io
if the real blocks arent in the order we think they are.
ok krw@ tedu@ miod@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/scsi/sd.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 81d5e3de42e..2bbb70f29da 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.235 2011/07/11 06:26:09 dlg Exp $ */ +/* $OpenBSD: sd.c,v 1.236 2011/07/12 00:41:43 dlg Exp $ */ /* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */ /*- @@ -163,7 +163,7 @@ sdattach(struct device *parent, struct device *self, void *aux) int sd_autoconf = scsi_autoconf | SCSI_SILENT | SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE; struct dk_cache dkc; - int error, result; + int error, result, sortby = BUFQ_DEFAULT; SC_DEBUG(sc_link, SDEV_DB2, ("sdattach:\n")); @@ -174,12 +174,6 @@ sdattach(struct device *parent, struct device *self, void *aux) sc_link->interpret_sense = sd_interpret_sense; sc_link->device_softc = sc; - /* - * Initialize disk structures. - */ - sc->sc_dk.dk_name = sc->sc_dev.dv_xname; - bufq_init(&sc->sc_bufq, BUFQ_DEFAULT); - if ((sc_link->flags & SDEV_ATAPI) && (sc_link->flags & SDEV_REMOVABLE)) sc_link->quirks |= SDEV_NOSYNCCACHE; @@ -233,8 +227,10 @@ sdattach(struct device *parent, struct device *self, void *aux) sc->sc_dev.dv_xname, dp->disksize / (1048576 / dp->secsize), dp->secsize, dp->disksize); - if (ISSET(sc->flags, SDF_THIN)) + if (ISSET(sc->flags, SDF_THIN)) { + sortby = BUFQ_FIFO; printf(", thin"); + } printf("\n"); break; @@ -248,6 +244,15 @@ sdattach(struct device *parent, struct device *self, void *aux) #endif } + /* + * Initialize disk structures. + */ + sc->sc_dk.dk_name = sc->sc_dev.dv_xname; + bufq_init(&sc->sc_bufq, sortby); + + /* + * Enable write cache by default. + */ memset(&dkc, 0, sizeof(dkc)); if (sd_ioctl_cache(sc, DIOCGCACHE, &dkc) == 0 && dkc.wrcache == 0) { dkc.wrcache = 1; |