Re: [PATCH v3 02/10] ubi: Expose mean erase counter for fastmap in sysfs

Richard Weinberger
2024-11-06T20:20:44Z

Rickard,

----- Ursprüngliche Mail -----
> Von: "Rickard X Andersson" <rickard.andersson@axis.com>
> An: "richard" <richard@nod.at>, "chengzhihao1" <chengzhihao1@huawei.com>, "linux-mtd" <linux-mtd@lists.infradead.org>,
> "rickard314 andersson" <rickard314.andersson@gmail.com>
> CC: "Rickard X Andersson" <rickard.andersson@axis.com>, "kernel" <kernel@axis.com>
> Gesendet: Freitag, 11. Oktober 2024 14:58:56
> Betreff: [PATCH v3 02/10] ubi: Expose mean erase counter for fastmap in sysfs

> Since the fastmap area has its own wear levelling it is valuable to
> provide a mean value for that area. This value can be used in order
> to estimate life expectancy of the flash.
>
> Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
> Signed-off-by: Rickard Andersson <rickard.andersson@axis.com>
> ---
> drivers/mtd/ubi/build.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
> index 231ca288f397..1c531d623a62 100644
> --- a/drivers/mtd/ubi/build.c
> +++ b/drivers/mtd/ubi/build.c
> @@ -133,6 +133,10 @@ static struct device_attribute dev_max_ec =
> __ATTR(max_ec, S_IRUGO, dev_attribute_show, NULL);
> static struct device_attribute dev_mean_ec =
> __ATTR(mean_ec, S_IRUGO, dev_attribute_show, NULL);
> +#ifdef CONFIG_MTD_UBI_FASTMAP
> +static struct device_attribute dev_mean_ec_fastmap =
> + __ATTR(mean_ec_fastmap, S_IRUGO, dev_attribute_show, NULL);
> +#endif

Do you really need distinct sysfs attributes for the fastmap and the
non-fastmap case? Userspace does not care whether fastmap is used or
not, all userspace is interested in is the mean erase counter value.

IMHO, the mean_ec attribute should combine the mean EC values from
the fastmap and the data area.

Thanks,
//richard