瀏覽代碼

[SCSI] expose eh_timed_out to the host template

It looks like megaraid_sas at least needs this to throttle its commands
as they begin to time out.  The code keeps the existing transport
template use of eh_timed_out (and allows the transport to override the
host if they both have this callback).

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
James Bottomley 18 年之前
父節點
當前提交
6c5f8ce1fb
共有 2 個文件被更改,包括 23 次插入1 次删除
  1. 10 1
      drivers/scsi/scsi_error.c
  2. 13 0
      include/scsi/scsi_host.h

+ 10 - 1
drivers/scsi/scsi_error.c

@@ -184,10 +184,19 @@ int scsi_delete_timer(struct scsi_cmnd *scmd)
  **/
 void scsi_times_out(struct scsi_cmnd *scmd)
 {
+	enum scsi_eh_timer_return (* eh_timed_out)(struct scsi_cmnd *);
+
 	scsi_log_completion(scmd, TIMEOUT_ERROR);
 
 	if (scmd->device->host->transportt->eh_timed_out)
-		switch (scmd->device->host->transportt->eh_timed_out(scmd)) {
+		eh_timed_out = scmd->device->host->transportt->eh_timed_out;
+	else if (scmd->device->host->hostt->eh_timed_out)
+		eh_timed_out = scmd->device->host->hostt->eh_timed_out;
+	else
+		eh_timed_out = NULL;
+
+	if (eh_timed_out)
+		switch (eh_timed_out(scmd)) {
 		case EH_HANDLED:
 			__scsi_done(scmd);
 			return;

+ 13 - 0
include/scsi/scsi_host.h

@@ -325,6 +325,19 @@ struct scsi_host_template {
 	 */
 	int (*proc_info)(struct Scsi_Host *, char *, char **, off_t, int, int);
 
+	/*
+	 * This is an optional routine that allows the transport to become
+	 * involved when a scsi io timer fires. The return value tells the
+	 * timer routine how to finish the io timeout handling:
+	 * EH_HANDLED:		I fixed the error, please complete the command
+	 * EH_RESET_TIMER:	I need more time, reset the timer and
+	 *			begin counting again
+	 * EH_NOT_HANDLED	Begin normal error recovery
+	 *
+	 * Status: OPTIONAL
+	 */
+	enum scsi_eh_timer_return (* eh_timed_out)(struct scsi_cmnd *);
+
 	/*
 	 * suspend support
 	 */