now that we know if the blocks under a disk are not in the order
the os uses them, we dont have to bother sorting io.
ok?
Index: sd.c
===================================================================
RCS file: /cvs/src/sys/scsi/sd.c,v
retrieving revision 1.235
diff -u -p -r1.235 sd.c
--- sd.c 11 Jul 2011 06:26:09 -0000 1.235
+++ sd.c 11 Jul 2011 12:17:40 -0000
@@ -163,7 +163,7 @@ sdattach(struct device *parent, struct d
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 d
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 d
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 d
#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;