diff mbox series

scsi: core: Add io timeout count for scsi device

Message ID 32aff63d-1b79-916a-50e2-1e6c113ed9ef@huawei.com
State New
Headers show
Series scsi: core: Add io timeout count for scsi device | expand

Commit Message

Wu Bo Sept. 16, 2022, 2:01 a.m. UTC
Current the scsi device has iorequest count, iodone count
and ioerr count, but lack of io timeout count.

For better tracking of scsi io, So add it now.

Signed-off-by: Wu Bo <wubo40@huawei.com>
---
  drivers/scsi/scsi_error.c  | 1 +
  drivers/scsi/scsi_sysfs.c  | 2 ++
  include/scsi/scsi_device.h | 1 +
  3 files changed, 4 insertions(+)

Comments

Bart Van Assche Sept. 16, 2022, 2:10 p.m. UTC | #1
On 9/15/22 19:01, Wu Bo wrote:
> Current the scsi device has iorequest count, iodone count
> and ioerr count, but lack of io timeout count.

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Bart Van Assche Sept. 16, 2022, 4:19 p.m. UTC | #2
On 9/15/22 19:01, Wu Bo wrote:
> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> index 448748e..e84aea9 100644
> --- a/drivers/scsi/scsi_error.c
> +++ b/drivers/scsi/scsi_error.c
> @@ -334,6 +334,7 @@ enum blk_eh_timer_return scsi_timeout(struct request 
> *req)
>          trace_scsi_dispatch_cmd_timeout(scmd);
>          scsi_log_completion(scmd, TIMEOUT_ERROR);
> 
> +       atomic_inc(&scmd->device->iotmo_cnt);
>          if (host->eh_deadline != -1 && !host->last_reset)
>                  host->last_reset = jiffies;

Please rebase this patch on top of Martin's for-next branch and repost 
this patch. I cannot apply this patch with "git am" on Martin's for-next 
branch.

Thanks,

Bart.
Wu Bo Sept. 20, 2022, 8:03 a.m. UTC | #3
On 2022/9/17 0:19, Bart Van Assche wrote:
> On 9/15/22 19:01, Wu Bo wrote:
>> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
>> index 448748e..e84aea9 100644
>> --- a/drivers/scsi/scsi_error.c
>> +++ b/drivers/scsi/scsi_error.c
>> @@ -334,6 +334,7 @@ enum blk_eh_timer_return scsi_timeout(struct 
>> request *req)
>>          trace_scsi_dispatch_cmd_timeout(scmd);
>>          scsi_log_completion(scmd, TIMEOUT_ERROR);
>>
>> +       atomic_inc(&scmd->device->iotmo_cnt);
>>          if (host->eh_deadline != -1 && !host->last_reset)
>>                  host->last_reset = jiffies;
> 
> Please rebase this patch on top of Martin's for-next branch and repost 
> this patch. I cannot apply this patch with "git am" on Martin's for-next 
> branch.
> 
> Thanks,
> 
> Bart.
> 
> 
> .
Sorry. I will repost the patch.

Thanks,

Wu Bo.
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 448748e..e84aea9 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -334,6 +334,7 @@  enum blk_eh_timer_return scsi_timeout(struct request 
*req)
         trace_scsi_dispatch_cmd_timeout(scmd);
         scsi_log_completion(scmd, TIMEOUT_ERROR);

+       atomic_inc(&scmd->device->iotmo_cnt);
         if (host->eh_deadline != -1 && !host->last_reset)
                 host->last_reset = jiffies;

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 9dad2fd..72e702c 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -970,6 +970,7 @@  static DEVICE_ATTR(field, S_IRUGO, 
show_iostat_##field, NULL)
  show_sdev_iostat(iorequest_cnt);
  show_sdev_iostat(iodone_cnt);
  show_sdev_iostat(ioerr_cnt);
+show_sdev_iostat(iotmo_cnt);

  static ssize_t
  sdev_show_modalias(struct device *dev, struct device_attribute *attr, 
char *buf)
@@ -1289,6 +1290,7 @@  static umode_t 
scsi_sdev_bin_attr_is_visible(struct kobject *kobj,
         &dev_attr_iorequest_cnt.attr,
         &dev_attr_iodone_cnt.attr,
         &dev_attr_ioerr_cnt.attr,
+       &dev_attr_iotmo_cnt.attr,
         &dev_attr_modalias.attr,
         &dev_attr_queue_depth.attr,
         &dev_attr_queue_type.attr,
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 3113471..78039d1 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -231,6 +231,7 @@  struct scsi_device {
         atomic_t iorequest_cnt;
         atomic_t iodone_cnt;
         atomic_t ioerr_cnt;
+       atomic_t iotmo_cnt;

         struct device           sdev_gendev,
                                 sdev_dev;