aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_sysfs.c
diff options
context:
space:
mode:
authorRen Mingxin <renmx@cn.fujitsu.com>2013-11-11 07:44:56 -0500
committerJames Bottomley <JBottomley@Parallels.com>2013-12-19 10:39:02 -0500
commitbb3b621a33d60fc2baddf31597ade01243e00a2c (patch)
tree73fae0429ce43ce37845e207cb36da2e8f54d42c /drivers/scsi/scsi_sysfs.c
parent76ad3e5956bf0bc8871ebd19ebda03f2287c966a (diff)
[SCSI] Set the minimum valid value of 'eh_deadline' as 0
The former minimum valid value of 'eh_deadline' is 1s, which means the earliest occasion to shorten EH is 1 second later since a command is failed or timed out. But if we want to skip EH steps ASAP, we have to wait until the first EH step is finished. If the duration of the first EH step is long, this waiting time is excruciating. So, it is necessary to accept 0 as the minimum valid value for 'eh_deadline'. According to my test, with Hannes' patchset 'New EH command timeout handler' as well, the minimum IO time is improved from 73s (eh_deadline = 1) to 43s(eh_deadline = 0) when commands are timed out by disabling RSCN and target port. Signed-off-by: Ren Mingxin <renmx@cn.fujitsu.com> Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/scsi_sysfs.c')
-rw-r--r--drivers/scsi/scsi_sysfs.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 8ff62c26a41c..9117d0bf408e 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -287,7 +287,9 @@ show_shost_eh_deadline(struct device *dev,
287{ 287{
288 struct Scsi_Host *shost = class_to_shost(dev); 288 struct Scsi_Host *shost = class_to_shost(dev);
289 289
290 return sprintf(buf, "%d\n", shost->eh_deadline / HZ); 290 if (shost->eh_deadline == -1)
291 return snprintf(buf, strlen("off") + 2, "off\n");
292 return sprintf(buf, "%u\n", shost->eh_deadline / HZ);
291} 293}
292 294
293static ssize_t 295static ssize_t
@@ -296,22 +298,34 @@ store_shost_eh_deadline(struct device *dev, struct device_attribute *attr,
296{ 298{
297 struct Scsi_Host *shost = class_to_shost(dev); 299 struct Scsi_Host *shost = class_to_shost(dev);
298 int ret = -EINVAL; 300 int ret = -EINVAL;
299 int deadline; 301 unsigned long deadline, flags;
300 unsigned long flags;
301 302
302 if (shost->transportt && shost->transportt->eh_strategy_handler) 303 if (shost->transportt && shost->transportt->eh_strategy_handler)
303 return ret; 304 return ret;
304 305
305 if (sscanf(buf, "%d\n", &deadline) == 1) { 306 if (!strncmp(buf, "off", strlen("off")))
306 spin_lock_irqsave(shost->host_lock, flags); 307 deadline = -1;
307 if (scsi_host_in_recovery(shost)) 308 else {
308 ret = -EBUSY; 309 ret = kstrtoul(buf, 10, &deadline);
309 else { 310 if (ret)
311 return ret;
312 if (deadline * HZ > UINT_MAX)
313 return -EINVAL;
314 }
315
316 spin_lock_irqsave(shost->host_lock, flags);
317 if (scsi_host_in_recovery(shost))
318 ret = -EBUSY;
319 else {
320 if (deadline == -1)
321 shost->eh_deadline = -1;
322 else
310 shost->eh_deadline = deadline * HZ; 323 shost->eh_deadline = deadline * HZ;
311 ret = count; 324
312 } 325 ret = count;
313 spin_unlock_irqrestore(shost->host_lock, flags);
314 } 326 }
327 spin_unlock_irqrestore(shost->host_lock, flags);
328
315 return ret; 329 return ret;
316} 330}
317 331