]> err.no Git - linux-2.6/blobdiff - drivers/scsi/sd.c
Merge branch 'upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/linville...
[linux-2.6] / drivers / scsi / sd.c
index 7a9d552f50e619b21188c85cbcb7749bd9522ea6..f6a452846fab7ba75a85c0242cdd4b4f3b881384 100644 (file)
@@ -443,8 +443,7 @@ static int sd_init_command(struct scsi_cmnd * SCpnt)
                SCpnt->cmnd[0] = READ_6;
                SCpnt->sc_data_direction = DMA_FROM_DEVICE;
        } else {
-               printk(KERN_ERR "sd: Unknown command %lx\n", rq->flags);
-/* overkill    panic("Unknown sd command %lx\n", rq->flags); */
+               printk(KERN_ERR "sd: Unknown command %x\n", rq->cmd_flags);
                return 0;
        }
 
@@ -840,7 +839,7 @@ static int sd_issue_flush(struct device *dev, sector_t *error_sector)
 static void sd_prepare_flush(request_queue_t *q, struct request *rq)
 {
        memset(rq->cmd, 0, sizeof(rq->cmd));
-       rq->flags |= REQ_BLOCK_PC;
+       rq->cmd_type = REQ_TYPE_BLOCK_PC;
        rq->timeout = SD_TIMEOUT;
        rq->cmd[0] = SYNCHRONIZE_CACHE;
        rq->cmd_len = 10;
@@ -1052,6 +1051,14 @@ sd_spinup_disk(struct scsi_disk *sdkp, char *diskname)
                                                      &sshdr, SD_TIMEOUT,
                                                      SD_MAX_RETRIES);
 
+                       /*
+                        * If the drive has indicated to us that it
+                        * doesn't have any media in it, don't bother
+                        * with any more polling.
+                        */
+                       if (media_not_present(sdkp, &sshdr))
+                               return;
+
                        if (the_result)
                                sense_valid = scsi_sense_valid(&sshdr);
                        retries++;
@@ -1060,14 +1067,6 @@ sd_spinup_disk(struct scsi_disk *sdkp, char *diskname)
                          ((driver_byte(the_result) & DRIVER_SENSE) &&
                          sense_valid && sshdr.sense_key == UNIT_ATTENTION)));
 
-               /*
-                * If the drive has indicated to us that it doesn't have
-                * any media in it, don't bother with any of the rest of
-                * this crap.
-                */
-               if (media_not_present(sdkp, &sshdr))
-                       return;
-
                if ((driver_byte(the_result) & DRIVER_SENSE) == 0) {
                        /* no sense, TUR either succeeded or failed
                         * with a status error */
@@ -1468,7 +1467,6 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname,
        res = sd_do_mode_sense(sdp, dbd, modepage, buffer, len, &data, &sshdr);
 
        if (scsi_status_is_good(res)) {
-               int ct = 0;
                int offset = data.header_length + data.block_descriptor_length;
 
                if (offset >= SD_BUF_SIZE - 2) {
@@ -1497,11 +1495,13 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname,
                        sdkp->DPOFUA = 0;
                }
 
-               ct =  sdkp->RCD + 2*sdkp->WCE;
-
-               printk(KERN_NOTICE "SCSI device %s: drive cache: %s%s\n",
-                      diskname, sd_cache_types[ct],
-                      sdkp->DPOFUA ? " w/ FUA" : "");
+               printk(KERN_NOTICE "SCSI device %s: "
+                      "write cache: %s, read cache: %s, %s\n",
+                      diskname,
+                      sdkp->WCE ? "enabled" : "disabled",
+                      sdkp->RCD ? "disabled" : "enabled",
+                      sdkp->DPOFUA ? "supports DPO and FUA"
+                      : "doesn't support DPO or FUA");
 
                return;
        }