patch-pre2.0.11 linux/drivers/scsi/scsi_ioctl.c

Next file: linux/drivers/scsi/sd.c
Previous file: linux/drivers/scsi/scsi.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file pre2.0.10/linux/drivers/scsi/scsi_ioctl.c linux/drivers/scsi/scsi_ioctl.c
@@ -171,7 +171,7 @@
     unsigned char opcode;
     int inlen, outlen, cmdlen;
     int needed, buf_needed;
-    int result;
+    int timeout, retries, result;
     
     if (!buffer)
 	return -EINVAL;
@@ -239,6 +239,22 @@
      */
     cmd[1] = ( cmd[1] & 0x1f ) | (dev->lun << 5);
     
+    switch (opcode)
+      {
+      case FORMAT_UNIT:
+	timeout =  2 * 60 * 60 * HZ; /* 2 Hours */
+	retries = 1;
+	break;
+      case START_STOP:
+	timeout =  60 * HZ;	/* 60 seconds */
+	retries = 1;
+	break;
+      default:
+	timeout = MAX_TIMEOUT;
+	retries = MAX_RETRIES;
+	break;
+      }
+
 #ifndef DEBUG_NO_CMD
     
     SCpnt = allocate_device(NULL, dev, 1);
@@ -246,8 +262,8 @@
     {
 	struct semaphore sem = MUTEX_LOCKED;
 	SCpnt->request.sem = &sem;
-	scsi_do_cmd(SCpnt,  cmd,  buf, needed,  scsi_ioctl_done,  MAX_TIMEOUT, 
-		    MAX_RETRIES);
+	scsi_do_cmd(SCpnt,  cmd,  buf, needed,  scsi_ioctl_done,
+		    timeout, retries);
 	down(&sem);
     }
     

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this