Skip to contentSkip to conversation

mtdoops: skip reading initially bad blocks

PATCH In review Roman Tereshonkov 2 participants 2 messages Dec 2, 2011 – Dec 4, 2011 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtdoops: skip reading initially bad blocks

Use block_isbad to check and skip the bad blocks reading. This will allow to get rid of the read errors if bad blocks are present initially.

---
 drivers/mtd/mtdoops.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/mtd/mtdoops.c +3 -0
index 1e2fa62..cea9279 100644
@@ -253,6 +253,9 @@ static void find_next_position(struct mtdoops_context *cxt)
 	size_t retlen;
 
 	for (page = 0; page < cxt->oops_pages; page++) {
+		if (mtd->block_isbad &&
+		    mtd->block_isbad(mtd, page * record_size))
+			continue;
 		/* Assume the page is used */
 		mark_page_used(cxt, page);
 		ret = mtd->read(mtd, page * record_size, MTDOOPS_HEADER_SIZE,
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 5 lines · Roman Tereshonkov

Use block_isbad to check and skip the bad blocks reading. This will allow to get rid of the read errors if bad blocks are present initially.

Looks like a candidate for the stable tree as it fixes a bad bug. I've added

and pushed to l2-mtd-2.6.git, thanks!

Signature · 2 lines
Best Regards,
Artem Bityutskiy