summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_debug.c
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2018-07-12 13:35:42 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2018-07-12 23:01:16 -0400
commit75aa3209c945fc711163ff1ecbc031bd13962a9d (patch)
tree35f64373c9f0fa0843f7f5cb88d1c33e10edeb77 /drivers/scsi/scsi_debug.c
parent920447f138917d8d5b830b752cff5e5f747f67e8 (diff)
downloadlinux-stable-75aa3209c945fc711163ff1ecbc031bd13962a9d.tar.gz
linux-stable-75aa3209c945fc711163ff1ecbc031bd13962a9d.tar.bz2
linux-stable-75aa3209c945fc711163ff1ecbc031bd13962a9d.zip
scsi: scsi_debug: skip long delays when ndelay small
A test program's runtime became impractically long since any non zero ndelay (e.g. 1 nanosec) caused Start Stop Unit to delay over 8 magnitudes greater than other commands. This patch skips long delays (on Start Stop Unit and Synchronize Cache) if ndelay is less than or equal to 10 microsecs. Signed-off-by: Douglas Gilbert <dgilbert@interlog.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/scsi_debug.c')
-rw-r--r--drivers/scsi/scsi_debug.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 24d7496cd9e2..4dda192b8fba 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -5790,11 +5790,13 @@ static int scsi_debug_queuecommand(struct Scsi_Host *shost,
fini:
if (F_DELAY_OVERR & flags)
return schedule_resp(scp, devip, errsts, pfp, 0, 0);
- else if ((sdebug_jdelay || sdebug_ndelay) && (flags & F_LONG_DELAY)) {
+ else if ((flags & F_LONG_DELAY) && (sdebug_jdelay > 0 ||
+ sdebug_ndelay > 10000)) {
/*
- * If any delay is active, for F_SSU_DELAY want at least 1
- * second and if sdebug_jdelay>0 want a long delay of that
- * many seconds; for F_SYNC_DELAY want 1/20 of that.
+ * Skip long delays if ndelay <= 10 microseconds. Otherwise
+ * for Start Stop Unit (SSU) want at least 1 second delay and
+ * if sdebug_jdelay>1 want a long delay of that many seconds.
+ * For Synchronize Cache want 1/20 of SSU's delay.
*/
int jdelay = (sdebug_jdelay < 2) ? 1 : sdebug_jdelay;
int denom = (flags & F_SYNC_DELAY) ? 20 : 1;