From 7235c8d00ccf2d6d1bde3a2bec476d45d8c7c2ab Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 9 Jan 2022 20:24:41 +0100 Subject: kernel: mtk_bmt: remap blocks after reaching bitflip threshold This ensures that blocks are remapped before data becomes corrupt Signed-off-by: Felix Fietkau --- target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'target/linux') 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; -- cgit v1.2.3