[PATCH 2/4] ubi: Expose mean erase counter for fastmap in sysfs
Rickard x Andersson
rickaran at axis.com
Wed Oct 9 06:44:56 PDT 2024
On 10/8/24 11:27, Zhihao Cheng wrote:
> 在 2024/10/4 16:22, Rickard Andersson 写道:
>> 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.
>>
>
> There are 2 cases shown as following:
> 1) fastmap is disabled: We can determine whether the wear-leveling
> algorithm works fine by comparing 'max_ec' with 'mean_ec'.
> 2) fastmap is enabled: The max_ec may come from first 64 PEBs(fastmap
> area), or it may come from data area(pnum > 64), how can we determine
> whether the wear-leveling algorithm works fine for data area?
Thanks for the feedback.
My main goal is to provide mean values to determine how worn down the
flash is. I am sort of assuming that the wear leveling algorithm works
but that it previously had bugs, which made it difficult to use max_ec
to get a complete picture of the wear.
I could add max_ec_fastmap for symmetry if you want? Then I will make
max_ec_fastmap cover blocks 0 - 63, and max_ec will cover 0 - LAST_BLOCK.
>
> 'if (!ubi->fm_disabled))' is enough.
>> + peb_count = UBI_FM_MAX_START;
>> + else
>> + return 0; /* No fastmap on this UBI device */
>
> If we format /dev/mtdX by command 'ubiformat -e 0', the return value '0'
> may confuse us, it means that the fastmap is disabled or the
> mean_ec_fastmap is 0.
Do you prefer the function "dev_attribute_show" to return -ENODEV in
case we have no fastmap? I.e this behavior:
/sys/class/ubi/ubi0 # cat mean_ec_fastmap
cat: read error: No such device
Best regards,
Rickard Andersson
More information about the linux-mtd
mailing list