SCSI: use scsi_device->timeout consistently
Subsystems (2)
PATCH RESEND 1/2 SCSI: use scsi_device->timeout consistently
Each high level driver uses scsi_device->timeout diffrently.
* sd sets sdev->timeout to SD_TIMEOUT if it's zero on attach. sdev->timeout is used for commands received from block queue but internal commands use SD_TIMEOUT directly.
* sr uses constant SR_TIMEOUT for all non-ioctl commands and IOCTL_TIMEOUT for sr ioctls.
* st sets sdev->timeout to ST_TIMEOUT unconditionally. st uses either sdev->timeout or scsi_tape->long_timeout depending on command type.
* osst uses osst_tape->timeout and osst_tape->long_timeout.
This patch unifies differing behaviors as follows.
* All highlevel drivers initialize sdev->timeout to its default value iff it's zero; otherwise, the specified value is used.
* All commands w/o specific timeout requirement use sdev->timeout. Commands which require special timeout uses HL-specific value such as IOCTL_TIMEOUT and scsi/osst_tape->long_timeout.
This patch also adds sdev local variable for shorter notation where multiple references to sdev are added.
---
Sorry, the original post had linux-scsi-owner@vger instead of linux-scsi@vger. Reposting.
drivers/scsi/osst.c | 78 ++++++++++++++++++++++++++-------------------------- drivers/scsi/osst.h | 1 drivers/scsi/sd.c | 31 +++++++++++--------- drivers/scsi/sr.c | 49 ++++++++++++++++++-------------- drivers/scsi/st.c | 3 +- 5 files changed, 87 insertions(+), 75 deletions(-)
drivers/scsi/sd.c +17 -14
@@ -186,7 +186,7 @@ static ssize_t sd_store_cache_type(strucreturn -EINVAL ; rcd = ct &0x01 ?1 :0 ; wce = ct &0x02 ?1 :0 ; -if (scsi_mode_sense (sdp,0x08 ,8 , buffer,sizeof (buffer),SD_TIMEOUT , +if (scsi_mode_sense (sdp,0x08 ,8 , buffer,sizeof (buffer), sdp->timeout,SD_MAX_RETRIES , &data,NULL ))return -EINVAL ; len = min_t(size_t, sizeof(buffer), data.length - data.header_length -
@@ -197,7 +197,7 @@ static ssize_t sd_store_cache_type(struc buffer_data[2 ] |= wce <<2 | rcd; sp = buffer_data[0 ] &0x80 ?1 :0 ; -if (scsi_mode_select (sdp,1 , sp,8 , buffer_data, len,SD_TIMEOUT , +if (scsi_mode_select (sdp,1 , sp,8 , buffer_data, len, sdp->timeout,SD_MAX_RETRIES , &data, &sshdr)) {if (scsi_sense_valid (&sshdr))scsi_print_sense_hdr (sdkp->disk->disk_name, &sshdr);
@@ -370,7 +370,6 @@ static int sd_init_command(struct scsi_cstruct gendisk *disk = rq->rq_disk;sector_t block = rq->sector;unsigned int this_count = SCpnt->request_bufflen >>9 ; -unsigned int timeout = sdp->timeout; SCSI_LOG_HLQUEUE(1, printk("sd_init_command: disk=%s, block=%llu, " "count=%d\n", disk->disk_name,
@@ -511,7 +510,7 @@ static int sd_init_command(struct scsi_c SCpnt->transfersize = sdp->sector_size; SCpnt->underflow = this_count <<9 ; SCpnt->allowed =SD_MAX_RETRIES ; - SCpnt->timeout_per_command = timeout; + SCpnt->timeout_per_command = sdp->timeout;/* * This is the completion routine we use. This is matched in terms
@@ -759,7 +758,7 @@ static int sd_media_changed(struct gendi*/ retval = -ENODEV ;if (scsi_block_when_processing_errors (sdp)) - retval =scsi_test_unit_ready (sdp,SD_TIMEOUT ,SD_MAX_RETRIES ); + retval =scsi_test_unit_ready (sdp, sdp->timeout,SD_MAX_RETRIES );/* * Unable to test, unit probably not ready. This usually
@@ -805,7 +804,7 @@ static int sd_sync_cache(struct scsi_dev* flush everything. */ res =scsi_execute_req (sdp, cmd,DMA_NONE ,NULL ,0 , &sshdr, -SD_TIMEOUT ,SD_MAX_RETRIES ); + sdp->timeout,SD_MAX_RETRIES );if (res ==0 )break ; }
@@ -838,9 +837,12 @@ static int sd_issue_flush(struct devicestatic void sd_prepare_flush (request_queue_t *q,struct request *rq) { +struct device *dev = rq->rq_disk->driverfs_dev; +struct scsi_device *sdp =to_scsi_device (dev); +memset (rq->cmd,0 ,sizeof (rq->cmd)); rq->cmd_type =REQ_TYPE_BLOCK_PC ; - rq->timeout =SD_TIMEOUT ; + rq->timeout = sdp->timeout; rq->cmd[0 ] =SYNCHRONIZE_CACHE ; rq->cmd_len =10 ; }
@@ -1028,6 +1030,7 @@ static int media_not_present(struct scsistatic void sd_spinup_disk (struct scsi_disk *sdkp,char *diskname) { +struct scsi_device *sdp = sdkp->device;unsigned char cmd[10 ];unsigned long spintime_expire =0 ;int retries, spintime;
@@ -1046,9 +1049,9 @@ sd_spinup_disk(struct scsi_disk *sdkp, c cmd[0 ] =TEST_UNIT_READY ;memset ((void *) &cmd[1 ],0 ,9 ); - the_result =scsi_execute_req (sdkp->device, cmd, + the_result =scsi_execute_req (sdp, cmd,DMA_NONE ,NULL ,0 , - &sshdr,SD_TIMEOUT , + &sshdr, sdp->timeout,SD_MAX_RETRIES );/*
@@ -1079,7 +1082,7 @@ sd_spinup_disk(struct scsi_disk *sdkp, c/* * The device does not want the automatic start to be issued. */ -if (sdkp->device->no_start_on_add) { +if (sdp->no_start_on_add) {break ; }
@@ -1103,9 +1106,9 @@ sd_spinup_disk(struct scsi_disk *sdkp, c cmd[1 ] =1 ;/* Return immediately */ memset ((void *) &cmd[2 ],0 ,8 ); cmd[4 ] =1 ;/* Start spin cycle */ -scsi_execute_req (sdkp->device, cmd,DMA_NONE , +scsi_execute_req (sdp, cmd,DMA_NONE ,NULL ,0 , &sshdr, -SD_TIMEOUT ,SD_MAX_RETRIES ); + sdp->timeout,SD_MAX_RETRIES ); spintime_expire = jiffies +100 *HZ ; spintime =1 ; }
@@ -1180,7 +1183,7 @@ repeat: the_result =scsi_execute_req (sdp, cmd,DMA_FROM_DEVICE , buffer, longrc ?12 :8 , &sshdr, -SD_TIMEOUT ,SD_MAX_RETRIES ); + sdp->timeout,SD_MAX_RETRIES );if (media_not_present (sdkp, &sshdr))return ;
@@ -1345,7 +1348,7 @@ sd_do_mode_sense(struct scsi_device *sdp struct scsi_sense_hdr *sshdr) {return scsi_mode_sense (sdp, dbd, modepage, buffer, len, -SD_TIMEOUT ,SD_MAX_RETRIES , data, + sdp->timeout,SD_MAX_RETRIES , data, sshdr); }
drivers/scsi/sr.c +28 -21
166 lines not on this page · raw message
drivers/scsi/st.c +2 -1
@@ -3986,7 +3986,8 @@ static int st_probe(struct device *dev) tpnt->partition =0 ; tpnt->new_partition =0 ; tpnt->nbr_partitions =0 ; - tpnt->device->timeout =ST_TIMEOUT ; +if (!SDp->timeout) + SDp->timeout =ST_TIMEOUT ; tpnt->long_timeout =ST_LONG_TIMEOUT ; tpnt->try_dio = try_direct_io && !SDp->host->unchecked_isa_dma;
drivers/scsi/osst.c +40 -38
282 lines not on this page · raw message
drivers/scsi/osst.h +0 -1
@@ -548,7 +548,6 @@ struct osst_tape {unsigned char default_drvbuffer;/* 0xff = don't touch, value 3 bits */ unsigned char pos_unknown;/* after reset position unknown */ int write_threshold; -int timeout;/* timeout for normal commands */ int long_timeout;/* timeout for commands known to take long time*/ /* Mode characteristics */
PATCH RESEND 2/2 SCSI: add scsi_device->retries
Add scsi_device->retries to provide generic control over command retries, which is very similar to sdev->timeout. The initial value is -1 and high level driver is free to override on attach if negative. Note that -1 has the same effect as 0 (no retry) and signifies that it's the default value. As with sdev->timeout, sdev->retries is exported under the device sysfs node.
All high level drivers are converted to use it for retry value. However, there are exceptions.
* sd_sync_cache() and sr::get_sectorsize() loop three more times around normal command execution on failure.
* st uses three retry limits - MAX_RETRIES, MAX_WRITE_RETRIES and MAX_READY_RETRIES, which are all zero. This patch only converts MAX_RETRIES to sdev->retries. Defining WRITE and READY retries in terms of sdev->retries would make more sense.
--- drivers/scsi/osst.c | 121 +++++++++++++++++++++++++++------------------ drivers/scsi/scsi_scan.c | 7 ++ drivers/scsi/scsi_sysfs.c | 28 ++++++++++ drivers/scsi/sd.c | 22 ++++---- drivers/scsi/sr.c | 10 ++- drivers/scsi/st.c | 10 ++- include/scsi/scsi_device.h | 1 7 files changed, 134 insertions(+), 65 deletions(-)
drivers/scsi/sd.c +12 -10
@@ -187,7 +187,7 @@ static ssize_t sd_store_cache_type(struc rcd = ct &0x01 ?1 :0 ; wce = ct &0x02 ?1 :0 ;if (scsi_mode_sense (sdp,0x08 ,8 , buffer,sizeof (buffer), sdp->timeout, -SD_MAX_RETRIES , &data,NULL )) + sdp->retries, &data,NULL ))return -EINVAL ; len =min_t (size_t,sizeof (buffer), data.length - data.header_length - data.block_descriptor_length);
@@ -198,7 +198,7 @@ static ssize_t sd_store_cache_type(struc sp = buffer_data[0 ] &0x80 ?1 :0 ;if (scsi_mode_select (sdp,1 , sp,8 , buffer_data, len, sdp->timeout, -SD_MAX_RETRIES , &data, &sshdr)) { + sdp->retries, &data, &sshdr)) {if (scsi_sense_valid (&sshdr))scsi_print_sense_hdr (sdkp->disk->disk_name, &sshdr);return -EINVAL ;
@@ -509,7 +509,7 @@ static int sd_init_command(struct scsi_c*/ SCpnt->transfersize = sdp->sector_size; SCpnt->underflow = this_count <<9 ; - SCpnt->allowed =SD_MAX_RETRIES ; + SCpnt->allowed = sdp->retries; SCpnt->timeout_per_command = sdp->timeout;/*
@@ -758,7 +758,7 @@ static int sd_media_changed(struct gendi*/ retval = -ENODEV ;if (scsi_block_when_processing_errors (sdp)) - retval =scsi_test_unit_ready (sdp, sdp->timeout,SD_MAX_RETRIES ); + retval =scsi_test_unit_ready (sdp, sdp->timeout, sdp->retries);/* * Unable to test, unit probably not ready. This usually
@@ -804,7 +804,7 @@ static int sd_sync_cache(struct scsi_dev* flush everything. */ res =scsi_execute_req (sdp, cmd,DMA_NONE ,NULL ,0 , &sshdr, - sdp->timeout,SD_MAX_RETRIES ); + sdp->timeout, sdp->retries);if (res ==0 )break ; }
@@ -1052,7 +1052,7 @@ sd_spinup_disk(struct scsi_disk *sdkp, c the_result =scsi_execute_req (sdp, cmd,DMA_NONE ,NULL ,0 , &sshdr, sdp->timeout, -SD_MAX_RETRIES ); + sdp->retries);/* * If the drive has indicated to us that it
@@ -1108,7 +1108,7 @@ sd_spinup_disk(struct scsi_disk *sdkp, c cmd[4 ] =1 ;/* Start spin cycle */ scsi_execute_req (sdp, cmd,DMA_NONE ,NULL ,0 , &sshdr, - sdp->timeout,SD_MAX_RETRIES ); + sdp->timeout, sdp->retries); spintime_expire = jiffies +100 *HZ ; spintime =1 ; }
@@ -1183,7 +1183,7 @@ repeat: the_result =scsi_execute_req (sdp, cmd,DMA_FROM_DEVICE , buffer, longrc ?12 :8 , &sshdr, - sdp->timeout,SD_MAX_RETRIES ); + sdp->timeout, sdp->retries);if (media_not_present (sdkp, &sshdr))return ;
@@ -1348,8 +1348,7 @@ sd_do_mode_sense(struct scsi_device *sdp struct scsi_sense_hdr *sshdr) {return scsi_mode_sense (sdp, dbd, modepage, buffer, len, - sdp->timeout,SD_MAX_RETRIES , data, - sshdr); + sdp->timeout, sdp->retries, data, sshdr); }/*
@@ -1673,6 +1672,9 @@ static int sd_probe(struct device *dev) sdp->timeout =SD_MOD_TIMEOUT ; } +if (sdp->retries <0 ) + sdp->retries =SD_MAX_RETRIES ; + gd->major =sd_major ((index &0xf0 ) >>4 ); gd->first_minor = ((index &0xf ) <<4 ) | (index &0xfff00 ); gd->minors =16 ;
include/scsi/scsi_device.h +1 -0
@@ -134,6 +134,7 @@ struct scsi_device {atomic_t ioerr_cnt;int timeout; +int retries;struct device sdev_gendev;struct class_device sdev_classdev;
drivers/scsi/scsi_sysfs.c +28 -0
@@ -443,6 +443,33 @@ sdev_store_timeout (struct device *dev, static DEVICE_ATTR(timeout, S_IRUGO | S_IWUSR, sdev_show_timeout, sdev_store_timeout);static ssize_t +sdev_show_retries (struct device *dev,struct device_attribute *attr,char *buf) +{ +struct scsi_device *sdev =to_scsi_device (dev); +int retries = sdev->retries; + +/* negative indicates uninitialized default */ +if (retries <0 ) + retries =0 ; + +return snprintf (buf,20 ,"%d\n" , retries); +} + +static ssize_t +sdev_store_retries (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) +{ +struct scsi_device *sdev =to_scsi_device (dev); +int retries; + +sscanf (buf,"%d\n" , &retries); +if (retries <0 ) +return -EINVAL ; + sdev->retries = retries; +return count; +} +static DEVICE_ATTR(retries, S_IRUGO | S_IWUSR, sdev_show_retries, sdev_store_retries); + +static ssize_t store_rescan_field (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) {scsi_rescan_device (dev);
@@ -548,6 +575,7 @@ static struct device_attribute *scsi_sys &dev_attr_delete, &dev_attr_state, &dev_attr_timeout, + &dev_attr_retries, &dev_attr_iocounterbits, &dev_attr_iorequest_cnt, &dev_attr_iodone_cnt,
drivers/scsi/sr.c +6 -4
@@ -185,7 +185,7 @@ int sr_media_change(struct cdrom_device_return -EINVAL ; } - retval =scsi_test_unit_ready (sdev, sdev->timeout,MAX_RETRIES ); + retval =scsi_test_unit_ready (sdev, sdev->timeout, sdev->retries);if (retval) {/* Unable to test, unit probably not ready. This usually * means there is no disc in the drive. Mark as changed,
@@ -407,7 +407,7 @@ static int sr_init_command(struct scsi_c*/ SCpnt->transfersize = sdev->sector_size; SCpnt->underflow = this_count <<9 ; - SCpnt->allowed =MAX_RETRIES ; + SCpnt->allowed = sdev->retries; SCpnt->timeout_per_command = sdev->timeout;/*
@@ -583,6 +583,8 @@ static int sr_probe(struct device *dev)if (!sdev->timeout) sdev->timeout =SR_TIMEOUT ; +if (sdev->retries <0 ) + sdev->retries =MAX_RETRIES ; cd->cdi.ops = &sr_dops; cd->cdi.handle = cd;
@@ -643,7 +645,7 @@ static void get_sectorsize(struct scsi_c/* Do the command and wait.. */ the_result =scsi_execute_req (sdev, cmd,DMA_FROM_DEVICE , buffer,8 ,NULL , sdev->timeout, -MAX_RETRIES ); + sdev->retries); retries--;
@@ -748,7 +750,7 @@ static void get_capabilities(struct scsi the_result =scsi_execute_req (sdev, cmd,DMA_NONE ,NULL ,0 , &sshdr, sdev->timeout, -MAX_RETRIES ); + sdev->retries); retries++; } while (retries < 5 &&
drivers/scsi/st.c +6 -4
@@ -609,7 +609,7 @@ static int cross_eof(struct scsi_tape * tape_name(STp), forward ? "forward" : "backward")); SRpnt =st_do_scsi (NULL , STp, cmd,0 ,DMA_NONE , - STp->device->timeout,MAX_RETRIES ,1 ); + STp->device->timeout, STp->device->retries,1 );if (!SRpnt)return (STp->buffer)->syscall_result;
@@ -1787,7 +1787,7 @@ static long read_tape(struct scsi_tape * SRpnt = *aSRpnt; SRpnt =st_do_scsi (SRpnt, STp, cmd, bytes,DMA_FROM_DEVICE , - STp->device->timeout,MAX_RETRIES ,1 ); + STp->device->timeout, STp->device->retries,1 );release_buffering (STp,1 ); *aSRpnt = SRpnt;if (!SRpnt)
@@ -2451,7 +2451,7 @@ static int do_load_unload(struct scsi_ta ); SRpnt =st_do_scsi (NULL , STp, cmd,0 ,DMA_NONE , - timeout,MAX_RETRIES ,1 ); + timeout, STp->device->retries,1 );if (!SRpnt)return (STp->buffer)->syscall_result;
@@ -2751,7 +2751,7 @@ static int st_int_ioctl(struct scsi_tape } SRpnt =st_do_scsi (NULL , STp, cmd, datalen, direction, - timeout,MAX_RETRIES ,1 ); + timeout, STp->device->retries,1 );if (!SRpnt)return (STp->buffer)->syscall_result;
@@ -3988,6 +3988,8 @@ static int st_probe(struct device *dev) tpnt->nbr_partitions =0 ;if (!SDp->timeout) SDp->timeout =ST_TIMEOUT ; +if (SDp->retries <0 ) + SDp->retries =MAX_RETRIES ; tpnt->long_timeout =ST_LONG_TIMEOUT ; tpnt->try_dio = try_direct_io && !SDp->host->unchecked_isa_dma;
drivers/scsi/osst.c +74 -47
499 lines not on this page · raw message
drivers/scsi/scsi_scan.c +7 -0
@@ -261,6 +261,13 @@ static struct scsi_device *scsi_alloc_sd*/ sdev->borken =1 ; +/* +* -1 indicates uninitialized default and equivalent to zero +* in effect. High level driver is allowed to adjust retries +* if it's negative. +*/ + sdev->retries =-1 ; + sdev->request_queue =scsi_alloc_queue (sdev);if (!sdev->request_queue) {/* release fn is set up in scsi_sysfs_device_initialise, so
Re: [PATCH RESEND 2/2] SCSI: add scsi_device->retries
Quoted 10 lines · Tejun Heo
Add
scsi_device->retriesto provide generic control over command retries, which is very similar tosdev->timeout. The initial value is -1 and high level driver is free to override on attach if negative. Note that -1 has the same effect as 0 (no retry) and signifies that it's the default value. As withsdev->timeout,sdev->retriesis exported under the device sysfs node.All high level drivers are converted to use it for retry value. However, there are exceptions.
Quoted 8 lines
*
sd_sync_cache()andsr::get_sectorsize()loop three more times around normal command execution on failure.* st uses three retry limits -
MAX_RETRIES,MAX_WRITE_RETRIESandMAX_READY_RETRIES, which are all zero. This patch only convertsMAX_RETRIEStosdev->retries. Defining WRITE and READY retries in terms ofsdev->retrieswould make more sense.
I am neither acking nor naking this now. The patch does not change st behavior but moves part of the retry strategy out of the driver. (Which is also good because it makes one of the retry limits user changeable.)
Combining all retry counts is something that may not be a good thing. Below is justification why st has three different retry limits.
For some devices one number of retries is not perfect for all functions.
The firmware of tape devices usually retries quite thoroughly before returning error. This is why the default zero applies to most cases.
MAX_WRITE_RETRIES is separate from MAX_RETRIES because a plausible strategy might be (maybe not any more) to allow no retries for write but allow retries for reading and repositioning. The writes should fail directly so that the minimum number of marginal errors will be written. The reads can be retried so that even marginal data can be recovered. (Note that this may lead to tape positioning errors and may not be a good strategy in all cases.)
MAX_READY_RETRIES is used for commands that don't move the tape. This is a situation where retrying is probably harmless.
Signature · 1 line
Kai
Re: [PATCH RESEND 2/2] SCSI: add scsi_device->retries
Hello,
Quoted 9 lines · Kai Makisara
Quoted 5 lines
* st uses three retry limits -
MAX_RETRIES,MAX_WRITE_RETRIESandMAX_READY_RETRIES, which are all zero. This patch only convertsMAX_RETRIEStosdev->retries. Defining WRITE and READY retries in terms ofsdev->retrieswould make more sense.I am neither acking nor naking this now. The patch does not change st behavior but moves part of the retry strategy out of the driver. (Which is also good because it makes one of the retry limits user changeable.)
Combining all retry counts is something that may not be a good thing. Below is justification why st has three different retry limits.
Quoted 7 lines
For some devices one number of retries is not perfect for all functions.
The firmware of tape devices usually retries quite thoroughly before returning error. This is why the default zero applies to most cases.
MAX_WRITE_RETRIESis separate fromMAX_RETRIESbecause a plausible strategy might be (maybe not any more) to allow no retries for write but allow retries for reading and repositioning. The writes should fail directly so that the minimum number of marginal errors will be written. The reads can be retried so that even marginal data can be recovered. (Note that this may lead to tape positioning errors and may not be a good strategy in all cases.)
MAX_READY_RETRIESis used for commands that don't move the tape. This is a situation where retrying is probably harmless.
I see. Then, how about adding and initializing STp->write_retries and STp->ready_retries according to SDp->retries (some reasonable default value, say write_retries is always zero while ready_retries is round up of retries * 1.1) and export both through sysfs? That will give lower level primitive control as other ULDs do and also allow users to configure each timeout separately if necessary.
Thanks.
Signature · 1 line
tejun
Re: [PATCH RESEND 2/2] SCSI: add scsi_device->retries
Quoted 31 lines · Tejun Heo
Hello,
Quoted 25 lines · Kai Makisara
Quoted 5 lines
* st uses three retry limits -
MAX_RETRIES,MAX_WRITE_RETRIESandMAX_READY_RETRIES, which are all zero. This patch only convertsMAX_RETRIEStosdev->retries. Defining WRITE and READY retries in terms ofsdev->retrieswould make more sense.I am neither acking nor naking this now. The patch does not change st behavior but moves part of the retry strategy out of the driver. (Which is also good because it makes one of the retry limits user changeable.)
Combining all retry counts is something that may not be a good thing. Below is justification why st has three different retry limits.
For some devices one number of retries is not perfect for all functions.
The firmware of tape devices usually retries quite thoroughly before returning error. This is why the default zero applies to most cases.
MAX_WRITE_RETRIESis separate fromMAX_RETRIESbecause a plausible strategy might be (maybe not any more) to allow no retries for write but allow retries for reading and repositioning. The writes should fail directly so that the minimum number of marginal errors will be written. The reads can be retried so that even marginal data can be recovered. (Note that this may lead to tape positioning errors and may not be a good strategy in all cases.)Quoted 2 lines
MAX_READY_RETRIESis used for commands that don't move the tape. This is a situation where retrying is probably harmless.
Quoted 7 lines
I see. Then, how about adding and initializing
STp->write_retriesandSTp->ready_retriesaccording toSDp->retries(some reasonable default value, saywrite_retriesis always zero whileready_retriesis round up of retries * 1.1) and export both through sysfs? That will give lower level primitive control as other ULDs do and also allow users to configure each timeout separately if necessary.
When I made the timeouts user changeable (using ioctl), I also thought about making retries changeable. However, there did not seem to be any real need to change the retry limits and I postponed the implementation. Now it would be easy to implement with sysfs but it may be still best to postpone that until someone asks for that feature.
One possibility would be to transform the different retry limit philosophy into a comment in the source and use lowlevel retry limit for all commands. The different limits are actually comments also now because I don't think anyone changes the defaults. (If anyone does, please tell us!)
If this is done, I will have the suspicion that someone some time changes the low-level retry limit to other than zero without knowing what this does to tapes.
Signature · 1 line
Kai
Quoted 2 lines · Tejun Heo
Each high level driver uses
scsi_device->timeoutdiffrently.
...
drivers/scsi/st.c static int st_probe(struct device *dev) · line 3990
Quoted 11 lines
Index:
scsi-misc-2.6/drivers/scsi/st.c
===================================================================drivers/scsi/st.c +2
-1@@ -3986,7 +3986,8 @@ static int st_probe(struct device *dev) tpnt->partition =0 ; tpnt->new_partition =0 ; tpnt->nbr_partitions =0 ; - tpnt->device->timeout =ST_TIMEOUT ; +if (!SDp->timeout) + SDp->timeout =ST_TIMEOUT ;
I don't think this should be done. It probably makes the default timeout way too short. The error recovery with tapes takes a long time. The user can change the timeout if the default (900 seconds) seems too long (or short).
I don't think there is anything in the midlevel or low-level code to set the timeout based on the device characteristics. This is left to the ULD.
Signature · 1 line
Kai
Quoted 19 lines · Kai Makisara
Quoted 2 lines · Tejun Heo
Each high level driver uses
scsi_device->timeoutdiffrently....
drivers/scsi/st.c static int st_probe(struct device *dev) · line 3990
Quoted 11 lines
Index:
scsi-misc-2.6/drivers/scsi/st.c
===================================================================drivers/scsi/st.c +2
-1@@ -3986,7 +3986,8 @@ static int st_probe(struct device *dev) tpnt->partition =0 ; tpnt->new_partition =0 ; tpnt->nbr_partitions =0 ; - tpnt->device->timeout =ST_TIMEOUT ; +if (!SDp->timeout) + SDp->timeout =ST_TIMEOUT ;I don't think this should be done. It probably makes the default timeout way too short. The error recovery with tapes takes a long time. The user can change the timeout if the default (900 seconds) seems too long (or short).
Quoted 1 line
I don't think there is anything in the midlevel or low-level code to set the timeout based on the device characteristics. This is left to the ULD.
Low level driver should configure timeout or retries to a known value iff it knows what it's doing, when it knows both transport and device-type specific characteristic. AFAICS, the only driver which modifies sdev->timeout is ipr and it does so only when it knows the device is of certain type. So, I don't think it will cause any trouble, and using different initialization in different ULDs is too subtle.
Thanks.
Signature · 1 line
tejun
Quoted 22 lines · Tejun Heo
Quoted 21 lines · Kai Makisara
Quoted 2 lines · Tejun Heo
Each high level driver uses
scsi_device->timeoutdiffrently....
drivers/scsi/st.c static int st_probe(struct device *dev) · line 3990
Quoted 11 lines
Index:
scsi-misc-2.6/drivers/scsi/st.c
===================================================================drivers/scsi/st.c +2
-1@@ -3986,7 +3986,8 @@ static int st_probe(struct device *dev) tpnt->partition =0 ; tpnt->new_partition =0 ; tpnt->nbr_partitions =0 ; - tpnt->device->timeout =ST_TIMEOUT ; +if (!SDp->timeout) + SDp->timeout =ST_TIMEOUT ;I don't think this should be done. It probably makes the default timeout way too short. The error recovery with tapes takes a long time. The user can change the timeout if the default (900 seconds) seems too long (or short).
Quoted 6 lines
Quoted 2 lines
I don't think there is anything in the midlevel or low-level code to set the timeout based on the device characteristics. This is left to the ULD.
Low level driver should configure timeout or retries to a known value iff it knows what it's doing, when it knows both transport and device-type specific characteristic.
I am not so optimistic ;-)
Quoted 5 lines
AFAICS, the only driver which modifies sdev->timeout is iprand it does so only when it knows the device is of certain type. So, I don't think it will cause any trouble, and using different initialization in different ULDs is too subtle.
It does not cause trouble now but I think it is an accident waiting to happen. The ULD probably knows more about the device characteristics than the low-level driver. (I admit that there are other than device specific aspects in setting timeouts and these should not be in ULD.)
What about this variant:
if (SDp->timeout < ST_TIMEOUT) SDp->timeout = ST_TIMEOUT;
It does guarantee that the timeout is long enough for tape drives. It also lets the low-level driver set a longer timeout if it has some reason to make it longer than the ULD does.
Signature · 1 line
Kai
Hello,
Quoted 6 lines · Kai Makisara
Quoted 5 lines
Quoted 2 lines
I don't think there is anything in the midlevel or low-level code to set the timeout based on the device characteristics. This is left to the ULD.
Low level driver should configure timeout or retries to a known value iff it knows what it's doing, when it knows both transport and device-type specific characteristic.
Quoted 8 lines
I am not so optimistic ;-)
Quoted 5 lines
AFAICS, the only driver which modifies sdev->timeout is iprand it does so only when it knows the device is of certain type. So, I don't think it will cause any trouble, and using different initialization in different ULDs is too subtle.
It does not cause trouble now but I think it is an accident waiting to happen. The ULD probably knows more about the device characteristics than the low-level driver. (I admit that there are other than device specific aspects in setting timeouts and these should not be in ULD.)
Yeah, in general, ULD should be in charge for determining default values but, then again, SCSI ULDs are driving extremely wide variety of devices hanging off all sorts of transports these days.
Quoted 5 lines
What about this variant:
if (SDp->timeout < ST_TIMEOUT) SDp->timeout = ST_TIMEOUT;It does guarantee that the timeout is long enough for tape drives. It also lets the low-level driver set a longer timeout if it has some reason to make it longer than the ULD does.
I don't know enough about tape devices to determine what's right here. I think it's better for me to leave st and osst to people who know better. I'll re-submit without os and osst changes.
Thanks.
Signature · 1 line
tejun