]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[SCSI] Reduce polling in sd.c
authorAlan Stern <stern@rowland.harvard.edu>
Wed, 11 Oct 2006 20:48:28 +0000 (16:48 -0400)
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>
Wed, 15 Nov 2006 18:11:36 +0000 (12:11 -0600)
If a drive reports that no media is present, there's no point in
continuing to ask it about media status.  This patch (as696) cuts the
TUR polling short as soon as the drive reports no media instead of
going a full 3 iterations.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/sd.c

index 84ff203ffedd77749276358825e488fb6d8cfd9d..152f4ff4ed7e1b531fc2f817ed7e1259ab9572ca 100644 (file)
@@ -1051,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++;
@@ -1059,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 */