Re: [RFC] Deferred disk spinup during system resume

From
Jeff Garzik <hidden>
Date
2011-01-06 22:12:21
Also in
linux-scsi
(linux-ide CC added)

On Thu, Jan 6, 2011 at 3:20 PM,  [off-list ref] wrote:
quoted hunk
index 66aa4be..ae8d9ca 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1276,6 +1276,7 @@ int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth,
 */
 static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc)
 {
+       struct ata_device *dev = qc->dev;
       struct scsi_cmnd *scmd = qc->scsicmd;
       struct ata_taskfile *tf = &qc->tf;
       const u8 *cdb = scmd->cmnd;
@@ -1294,23 +1295,9 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc)
               goto invalid_fld;       /* power conditions not supported */

       if (cdb[4] & 0x1) {
-               tf->nsect = 1;  /* 1 sector, lba=0 */
-
-               if (qc->dev->flags & ATA_DFLAG_LBA) {
-                       tf->flags |= ATA_TFLAG_LBA;
-
-                       tf->lbah = 0x0;
-                       tf->lbam = 0x0;
-                       tf->lbal = 0x0;
-                       tf->device |= ATA_LBA;
-               } else {
-                       /* CHS */
-                       tf->lbal = 0x1; /* sect */
-                       tf->lbam = 0x0; /* cyl low */
-                       tf->lbah = 0x0; /* cyl high */
-               }
-
-               tf->command = ATA_CMD_VERIFY;   /* READ VERIFY */
+               dev->link->eh_info.dev_action[dev->devno] |= ATA_EH_VERIFY;
+               ata_port_schedule_eh(dev->link->ap);
+               goto skip;
       } else {
               /* Some odd clown BIOSen issue spindown on power off (ACPI S4
                * or S5) causing some drives to spin up and down again.
This really breaks the model where we are simply performing a
translation -- where queueing and execution of the translated qc is
kept separate from the SCSI->ATA translation itself.

The above code should be left as-is, except perhaps it could set a
'verify' flag in the qc, which would then trigger the EH behavior you
seek.

     Jeff
Thread (1 message) 1 message, 1 author, last reply 2011-01-06
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help