[RFC 0/1] ubi: An interface for dump the mapping between LEBs and PEBs

From: ZhaoLong Wang
Date: Sat Jul 22 2023 - 06:26:16 EST


When a metadata exception occurs on a device using UBIFS, we can easily
obtain the LEB number of the data exception from the log, but the PEB
number corresponding to the LEB cannot be obtained.

In some production lines, the NAND flash produced by the NAND flash
cannot provide reliable ECC error correction capabilities. The file
system damage is always related to the flash eraseblock exception.
Therefore, I hope that there is a way to quickly obtain the mapping
between LEBs and PEBs in the user space. In this way, the tool of
user mode can be used to debug possible faulty physical blocks
more conveniently.

Currently, the implementation of this interface is rough. It does
not obtain necessary locks when traversing the entire eba_tbl. Therefore,
this operation race with the volume update process (such as resize and
wear-leveling). As a result, the user mode obtains incorrect mapping
information. However, in practice, when the development and O&M need
to use this interface, frequent volume management operations do not
occur. Therefore, this problem may be tolerated.

I hope the experts will give valuable comments on this patch. If this
interface is acceptable, I'll make it perform as well as I can.

ZhaoLong Wang (1):
ubi: An interface is added for dump the mapping between LEBs and PEBs

drivers/mtd/ubi/debug.c | 104 ++++++++++++++++++++++++++++++++++++++++
drivers/mtd/ubi/eba.c | 24 ----------
drivers/mtd/ubi/ubi.h | 24 ++++++++++
3 files changed, 128 insertions(+), 24 deletions(-)

--
2.31.1