[openwrt/openwrt] kernel: mtk_bmt: remap blocks after reaching bitflip threshold

LEDE Commits lede-commits at lists.infradead.org
Thu Jan 13 11:13:50 PST 2022


nbd pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/7235c8d00ccf2d6d1bde3a2bec476d45d8c7c2ab

commit 7235c8d00ccf2d6d1bde3a2bec476d45d8c7c2ab
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Sun Jan 9 20:24:41 2022 +0100

    kernel: mtk_bmt: remap blocks after reaching bitflip threshold
    
    This ensures that blocks are remapped before data becomes corrupt
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c b/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c
index 84538f9180..2140c619da 100644
--- a/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c
+++ b/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c
@@ -529,6 +529,10 @@ mtk_bmt_read(struct mtd_info *mtd, loff_t from,
 			goto out;
 		}
 
+		if (cur_ret >= mtd->bitflip_threshold &&
+		    mapping_block_in_range(block))
+			update_bmt(block, mtd->erasesize);
+
 		ops->retlen += cur_ops.retlen;
 		ops->oobretlen += cur_ops.oobretlen;
 



More information about the lede-commits mailing list