[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7c13f4f8-0921-5a15-70bc-248550f1efa4@acm.org>
Date: Thu, 8 Jun 2023 09:44:26 -0700
From: Bart Van Assche <bvanassche@....org>
To: Lu Hongfei <luhongfei@...o.com>,
Alim Akhtar <alim.akhtar@...sung.com>,
Avri Altman <avri.altman@....com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Bean Huo <beanhuo@...ron.com>,
Jinyoung Choi <j-young.choi@...sung.com>,
Peter Wang <peter.wang@...iatek.com>,
Daniil Lunev <dlunev@...omium.org>,
"open list:UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER"
<linux-scsi@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>
Cc: opensource.kernel@...o.com
Subject: Re: [PATCH] scsi: ufs: wb: Add explicit flush_threshold sysfs
attribute
On 6/8/23 03:16, Lu Hongfei wrote:
> +static ssize_t wb_flush_threshold_show(struct device *dev,
> + struct device_attribute *attr,
> + char *buf)
> +{
> + struct ufs_hba *hba = dev_get_drvdata(dev);
> +
> + return sysfs_emit(buf, "%d\n", hba->vps->wb_flush_threshold);
> +}
Since wb_flush_threshold is unsigned, please change %d into %u.
> + if (!ufshcd_is_wb_allowed(hba)) {
> + dev_warn(dev, "It is not allowed to configure WB buf flush threshold!\n");
> + return -EOPNOTSUPP;
> + }
The above check prevents configuring the flush threshold before enabling
the write booster mechanism. I don't think users will like this. Please
leave out the above check.
> + if (kstrtouint(buf, 0, &wb_flush_threshold))
> + return -EINVAL;
> +
> + /* The range of values for wb_flush_threshold is (0,10] */
> + if (wb_flush_threshold <= 0 || wb_flush_threshold > 10) {
> + dev_err(dev, "The value of wb_flush_threshold is invalid!\n");
> + return -EINVAL;
> + }
Please change '10' in the above code into UFS_WB_BUF_REMAIN_PERCENT(100)
to make the above code easier to read.
Thanks,
Bart.
Powered by blists - more mailing lists