ubi: Implement ioctl for detailed erase counters
authorRickard Andersson <rickard.andersson@axis.com>
Mon, 16 Dec 2024 08:54:20 +0000 (09:54 +0100)
committerRichard Weinberger <richard@nod.at>
Sat, 18 Jan 2025 14:32:52 +0000 (15:32 +0100)
commit01099f635a4c68b8574d350a972ba062dd5142e9
tree3773f1e0f9ebc5d0e878732253a74f1b40a5b7c8
parent3156ceb222414456084d964f43ada071206039b8
ubi: Implement ioctl for detailed erase counters

Currently, "max_ec" can be read from sysfs, which provides a limited
view of the flash device’s wear. In certain cases, such as bugs in
the wear-leveling algorithm, specific blocks can be worn down more
than others, resulting in uneven wear distribution. Also some use cases
can wear the erase blocks of the fastmap area more heavily than other
parts of flash.
Providing detailed erase counter values give a better understanding of
the overall flash wear and is needed to be able to calculate for example
expected life time.
There exists more detailed info in debugfs, but this information is
only available for debug builds.

Signed-off-by: Rickard Andersson <rickard.andersson@axis.com>
Tested-by: Zhihao Cheng <chengzhihao1@huawei.com>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
drivers/mtd/ubi/cdev.c