aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files/drivers
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2022-01-09 20:24:41 +0100
committerFelix Fietkau <nbd@nbd.name>2022-01-13 18:33:06 +0100
commit7235c8d00ccf2d6d1bde3a2bec476d45d8c7c2ab (patch)
tree3d6c09a1cf5a059c14295916f609753376613373 /target/linux/generic/files/drivers
parent0ddead089778e399d01a744d91eed3d665922bd4 (diff)
downloadupstream-7235c8d00ccf2d6d1bde3a2bec476d45d8c7c2ab.tar.gz
upstream-7235c8d00ccf2d6d1bde3a2bec476d45d8c7c2ab.tar.bz2
upstream-7235c8d00ccf2d6d1bde3a2bec476d45d8c7c2ab.zip
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@nbd.name>
Diffstat (limited to 'target/linux/generic/files/drivers')
-rw-r--r--target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c4
1 files changed, 4 insertions, 0 deletions
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;