From b6651129cc27d56a9cbefcb5f713cea7706fd6b7 Mon Sep 17 00:00:00 2001 From: Date: Sun, 3 Apr 2005 14:52:44 -0500 Subject: [PATCH] consolidate timeout defintions in scsi.h Adapted from a patch in SuSE's kernel SRPM. Signed-off-by: James Bottomley --- include/scsi/scsi.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/scsi') diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index 1d54c06..3507b3d 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h @@ -360,6 +360,15 @@ struct scsi_lun { #define sense_error(sense) ((sense) & 0xf) #define sense_valid(sense) ((sense) & 0x80); +/* + * default timeouts +*/ +#define FORMAT_UNIT_TIMEOUT (2 * 60 * 60 * HZ) +#define START_STOP_TIMEOUT (60 * HZ) +#define MOVE_MEDIUM_TIMEOUT (5 * 60 * HZ) +#define READ_ELEMENT_STATUS_TIMEOUT (5 * 60 * HZ) +#define READ_DEFECT_DATA_TIMEOUT (60 * HZ ) + #define IDENTIFY_BASE 0x80 #define IDENTIFY(can_disconnect, lun) (IDENTIFY_BASE |\ -- cgit v1.1 From d3a933dc9851e74581f9f4c8e703e77901ae8d01 Mon Sep 17 00:00:00 2001 From: Date: Sun, 3 Apr 2005 14:55:06 -0500 Subject: [PATCH] scsi: remove unused scsi_cmnd->internal_timeout field scsi_cmnd->internal_timeout field doesn't have any meaning anymore. Kill the field. Signed-off-by: Tejun Heo Signed-off-by: James Bottomley --- include/scsi/scsi_cmnd.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'include/scsi') diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 9d9871c..ae45d6f 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -65,12 +65,6 @@ struct scsi_cmnd { int timeout_total; int timeout; - /* - * We handle the timeout differently if it happens when a reset, - * abort, etc are in process. - */ - unsigned volatile char internal_timeout; - unsigned char cmd_len; unsigned char old_cmd_len; enum dma_data_direction sc_data_direction; -- cgit v1.1 From c6295cdf656de63d6d1123def71daba6cd91939c Mon Sep 17 00:00:00 2001 From: Date: Sun, 3 Apr 2005 14:59:11 -0500 Subject: [PATCH] scsi: remove meaningless scsi_cmnd->serial_number_at_timeout field scsi_cmnd->serial_number_at_timeout doesn't serve any purpose anymore. All serial_number == serial_number_at_timeout tests are always true in abort callbacks. Kill the field. Also, as ->pid always equals ->serial_number and ->serial_number doesn't have any special meaning anymore, update comments above ->serial_number accordingly. Once we remove all uses of this field from all lldd's, this field should go. Signed-off-by: Tejun Heo Signed-off-by: James Bottomley --- include/scsi/scsi_cmnd.h | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'include/scsi') diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index ae45d6f..07f5c69 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -43,21 +43,17 @@ struct scsi_cmnd { void (*done) (struct scsi_cmnd *); /* Mid-level done function */ /* - * A SCSI Command is assigned a nonzero serial_number when internal_cmnd - * passes it to the driver's queue command function. The serial_number - * is cleared when scsi_done is entered indicating that the command has - * been completed. If a timeout occurs, the serial number at the moment - * of timeout is copied into serial_number_at_timeout. By subsequently - * comparing the serial_number and serial_number_at_timeout fields - * during abort or reset processing, we can detect whether the command - * has already completed. This also detects cases where the command has - * completed and the SCSI Command structure has already being reused - * for another command, so that we can avoid incorrectly aborting or - * resetting the new command. - * The serial number is only unique per host. + * A SCSI Command is assigned a nonzero serial_number before passed + * to the driver's queue command function. The serial_number is + * cleared when scsi_done is entered indicating that the command + * has been completed. It currently doesn't have much use other + * than printk's. Some lldd's use this number for other purposes. + * It's almost certain that such usages are either incorrect or + * meaningless. Please kill all usages other than printk's. Also, + * as this number is always identical to ->pid, please convert + * printk's to use ->pid, so that we can kill this field. */ unsigned long serial_number; - unsigned long serial_number_at_timeout; int retries; int allowed; -- cgit v1.1 From bf341919dbc1fbcbb565fb3224c840760ebd9f85 Mon Sep 17 00:00:00 2001 From: Date: Tue, 12 Apr 2005 17:49:09 -0500 Subject: scsi: add DID_REQUEUE to the error handling We have a DID_IMM_RETRY to require a retry at once, but we could do with a DID_REQUEUE to instruct the mid-layer to treat this command in the same manner as QUEUE_FULL or BUSY (i.e. halt the submission until another command returns ... or the queue pressure builds if there are no outstanding commands). Signed-off-by: James Bottomley --- include/scsi/scsi.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/scsi') diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index 3507b3d..659ecf48 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h @@ -295,6 +295,8 @@ struct scsi_lun { #define DID_PASSTHROUGH 0x0a /* Force command past mid-layer */ #define DID_SOFT_ERROR 0x0b /* The low level driver just wish a retry */ #define DID_IMM_RETRY 0x0c /* Retry without decrementing retry count */ +#define DID_REQUEUE 0x0d /* Requeue command (no immediate retry) also + * without decrementing the retry count */ #define DRIVER_OK 0x00 /* Driver status */ /* -- cgit v1.1 From 06f81ea8ca09b880cadf101d7e23b500e9c164bc Mon Sep 17 00:00:00 2001 From: Date: Sun, 17 Apr 2005 14:57:29 -0500 Subject: [PATCH] scsi: remove volatile from scsi data This patch removes volatile qualifier from scsi_device->device_busy, Scsi_Host->host_busy and ->host_failed as the volatile qualifiers don't serve any purpose now. While at it, convert those fields from unsigned short to unsigned int as suggested by Christoph. Signed-off-by: Tejun Heo Signed-off-by: James Bottomley --- include/scsi/scsi_device.h | 3 ++- include/scsi/scsi_host.h | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'include/scsi') diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 07d97405..7099d2c 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -43,7 +43,8 @@ struct scsi_device { struct list_head siblings; /* list of all devices on this host */ struct list_head same_target_siblings; /* just the devices sharing same target id */ - volatile unsigned short device_busy; /* commands actually active on low-level */ + unsigned int device_busy; /* commands actually active on + * low-level. protected by queue_lock. */ spinlock_t sdev_lock; /* also the request queue_lock */ spinlock_t list_lock; struct list_head cmd_list; /* queue of in use SCSI Command structures */ diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 27f2c4e..1cee1e1 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -448,8 +448,14 @@ struct Scsi_Host { wait_queue_head_t host_wait; struct scsi_host_template *hostt; struct scsi_transport_template *transportt; - volatile unsigned short host_busy; /* commands actually active on low-level */ - volatile unsigned short host_failed; /* commands that failed. */ + + /* + * The following two fields are protected with host_lock; + * however, eh routines can safely access during eh processing + * without acquiring the lock. + */ + unsigned int host_busy; /* commands actually active on low-level */ + unsigned int host_failed; /* commands that failed. */ unsigned short host_no; /* Used for IOCTL_GET_IDLUN, /proc/scsi et al. */ int resetting; /* if set, it means that last_reset is a valid value */ -- cgit v1.1