kernel: mtk_bmt: remap blocks after reaching bitflip threshold
authorFelix Fietkau <nbd@nbd.name>
Sun, 9 Jan 2022 19:24:41 +0000 (20:24 +0100)
committerFelix Fietkau <nbd@nbd.name>
Thu, 13 Jan 2022 17:33:06 +0000 (18:33 +0100)
This ensures that blocks are remapped before data becomes corrupt

Signed-off-by: Felix Fietkau <nbd@nbd.name>
target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c

index 84538f9180dfb729ae88553945cc49af7785d6ed..2140c619da9624643031106c44a6d24096616748 100644 (file)
@@ -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;