Re: [PATCH v3 01/10] ubi: Expose mean erase counter in sysfs

Rickard x Andersson
2024-11-15T09:01:06Z

On 11/14/24 19:50, Richard Weinberger wrote:
> ----- Ursprüngliche Mail -----
>> Von: "chengzhihao1" <chengzhihao1@huawei.com>
>> An: "richard" <richard@nod.at>, "Rickard X Andersson" <rickard.andersson@axis.com>
>> CC: "linux-mtd" <linux-mtd@lists.infradead.org>, "rickard314 andersson" <rickard314.andersson@gmail.com>, "kernel"
>> <kernel@axis.com>
>> Gesendet: Donnerstag, 7. November 2024 02:39:45
>> Betreff: Re: [PATCH v3 01/10] ubi: Expose mean erase counter in sysfs
>
>> 在 2024/11/7 4:34, Richard Weinberger 写道:
>>> ----- Ursprüngliche Mail -----
>>>> Von: "Rickard X Andersson" <rickard.andersson@axis.com>
>>>> There exists more detailed info in debugfs, but this information is
>>>> only available for debug builds.
>>>
>>> If the detailed info is useful for regular userspace we can also think
>>> of adding a non-debugfs interface for it.
>>> E.g. an ioctl() that returns this data in binary form.
>>
>> This method sounds better.
>
> Rickard, what do you think about this option?
>
> Thanks,
> //richard

Hi,

I would prefer to keep it in sysfs. We already have the following in
sysfs (/sys/class/ubi/ubiX) that is related to flash wear:

-r--r--r-- 1 root root 4096 Oct 24 08:54 avail_eraseblocks
-r--r--r-- 1 root root 4096 Nov 15 08:26 bad_peb_count
-r--r--r-- 1 root root 4096 Nov 15 08:26 max_ec
-r--r--r-- 1 root root 4096 Oct 24 08:54 reserved_for_bad

With my patch series the following will be added for normal builds:

-r--r--r-- 1 root root 4096 Nov 15 08:26 mean_ec

If fastmap is enabled (CONFIG_MTD_UBI_FASTMAP=y) also the following is
added:

-r--r--r-- 1 root root 4096 Nov 15 08:26 max_ec_data
-r--r--r-- 1 root root 4096 Nov 15 08:26 max_ec_fastmap
-r--r--r-- 1 root root 4096 Nov 15 08:26 mean_ec_data
-r--r--r-- 1 root root 4096 Nov 15 08:26 mean_ec_fastmap

If you think the above is too "bloated" in the fastmap case
(CONFIG_MTD_UBI_FASTMAP=y) we could reduce the additional files in the
fastmap case to the following (More similar to my V1 version of the
patch series):

-r--r--r-- 1 root root 4096 Nov 15 08:26 mean_ec_fastmap

Thanks,
Rickard A.