lkml.org 
[lkml]   [2021]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] nvme: Export fast_io_fail_tmo to sysfs
Date


> On Mar 31, 2021, at 8:12 AM, Daniel Wagner <dwagner@suse.de> wrote:
>
> Commit 8c4dfea97f15 ("nvme-fabrics: reject I/O to offline device")
> introduced fast_io_fail_tmo but didn't export the value to sysfs. That
> means the value is hard coded during compile time. Export the timeout
> value to user space via sysfs to allow runtime configuration.
>
> Cc: Victor Gladkov <Victor.Gladkov@kioxia.com>
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>
> This patch is against nvme-5.13
>
> BTW, checkpatch complains with
>
> WARNING: Symbolic permissions 'S_IRUGO | S_IWUSR' are not preferred. Consider using octal permissions '0644'.
>
> Is this something we want to adapt to?
>
> drivers/nvme/host/core.c | 31 +++++++++++++++++++++++++++++++
> 1 file changed, 31 insertions(+)
>
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 40215a0246e4..c8de0e37c7d9 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -3696,6 +3696,36 @@ static ssize_t nvme_ctrl_reconnect_delay_store(struct device *dev,
> static DEVICE_ATTR(reconnect_delay, S_IRUGO | S_IWUSR,
> nvme_ctrl_reconnect_delay_show, nvme_ctrl_reconnect_delay_store);
>
> +static ssize_t nvme_ctrl_fast_io_fail_tmo_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
> +
> + if (ctrl->opts->fast_io_fail_tmo == -1)
> + return sprintf(buf, "off\n");
> + return sprintf(buf, "%d\n", ctrl->opts->fast_io_fail_tmo);
> +}
> +
> +static ssize_t nvme_ctrl_fast_io_fail_tmo_store(struct device *dev,
> + struct device_attribute *attr, const char *buf, size_t count)
> +{
> + struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
> + struct nvmf_ctrl_options *opts = ctrl->opts;
> + int fast_io_fail_tmo, err;
> +
> + err = kstrtoint(buf, 10, &fast_io_fail_tmo);
> + if (err)
> + return -EINVAL;
> +
> + else if (fast_io_fail_tmo < 0)
> + opts->fast_io_fail_tmo = -1;
> + else
> + opts->fast_io_fail_tmo = fast_io_fail_tmo;
> + return count;
> +}
> +static DEVICE_ATTR(fast_io_fail_tmo, S_IRUGO | S_IWUSR,
> + nvme_ctrl_fast_io_fail_tmo_show, nvme_ctrl_fast_io_fail_tmo_store);
> +
> static struct attribute *nvme_dev_attrs[] = {
> &dev_attr_reset_controller.attr,
> &dev_attr_rescan_controller.attr,
> @@ -3715,6 +3745,7 @@ static struct attribute *nvme_dev_attrs[] = {
> &dev_attr_hostid.attr,
> &dev_attr_ctrl_loss_tmo.attr,
> &dev_attr_reconnect_delay.attr,
> + &dev_attr_fast_io_fail_tmo.attr,
> NULL
> };
>
> --
> 2.29.2
>


Reviewed-by: Himanshu Madhani <himanshu.madhaani@oracle.com>

--
Himanshu Madhani Oracle Linux Engineering

\
 
 \ /
  Last update: 2021-03-31 21:56    [W:0.047 / U:2.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site