Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75aa3209 authored by Douglas Gilbert's avatar Douglas Gilbert Committed by Martin K. Petersen
Browse files

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: default avatarDouglas Gilbert <dgilbert@interlog.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 920447f1
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -5790,11 +5790,13 @@ static int scsi_debug_queuecommand(struct Scsi_Host *shost,
fini:
fini:
	if (F_DELAY_OVERR & flags)
	if (F_DELAY_OVERR & flags)
		return schedule_resp(scp, devip, errsts, pfp, 0, 0);
		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
		 * Skip long delays if ndelay <= 10 microseconds. Otherwise
		 * second and if sdebug_jdelay>0 want a long delay of that
		 * for Start Stop Unit (SSU) want at least 1 second delay and
		 * many seconds; for F_SYNC_DELAY want 1/20 of that.
		 * 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 jdelay = (sdebug_jdelay < 2) ? 1 : sdebug_jdelay;
		int denom = (flags & F_SYNC_DELAY) ? 20 : 1;
		int denom = (flags & F_SYNC_DELAY) ? 20 : 1;