upgrade to linux 2.6.10-1.12_FC2
[linux-2.6.git] / drivers / scsi / sd.c
index ebd71b7..0d10f10 100644 (file)
@@ -48,6 +48,7 @@
 #include <linux/blkdev.h>
 #include <linux/blkpg.h>
 #include <linux/kref.h>
+#include <linux/delay.h>
 #include <asm/uaccess.h>
 
 #include <scsi/scsi.h>
@@ -944,7 +945,6 @@ sd_spinup_disk(struct scsi_disk *sdkp, char *diskname,
                 * Issue command to spin up drive when not ready
                 */
                } else if (SRpnt->sr_sense_buffer[2] == NOT_READY) {
-                       unsigned long time1;
                        if (!spintime) {
                                printk(KERN_NOTICE "%s: Spinning up disk...",
                                       diskname);
@@ -963,12 +963,8 @@ sd_spinup_disk(struct scsi_disk *sdkp, char *diskname,
                                spintime_value = jiffies;
                        }
                        spintime = 1;
-                       time1 = HZ;
                        /* Wait 1 second for next try */
-                       do {
-                               current->state = TASK_UNINTERRUPTIBLE;
-                               time1 = schedule_timeout(time1);
-                       } while(time1);
+                       msleep(1000);
                        printk(".");
                } else {
                        /* we don't understand the sense code, so it's
@@ -1108,6 +1104,11 @@ repeat:
                        (buffer[9] << 16) | (buffer[10] << 8) | buffer[11];
        }       
 
+       /* Some devices return the total number of sectors, not the
+        * highest sector number.  Make the necessary adjustment. */
+       if (sdp->fix_capacity)
+               --sdkp->capacity;
+
 got_data:
        if (sector_size == 0) {
                sector_size = 512;