Patchwork mtdoops: skip reading initially bad blocks

login
register
mail settings
Submitter Roman Tereshonkov
Date Dec. 2, 2011, 1:07 p.m.
Message ID <1322831237-22044-1-git-send-email-roman.tereshonkov@nokia.com>
Download mbox | patch
Permalink /patch/128849/
State Accepted
Commit 3538c56329936c78f7d356889908790006d0124c
Headers show

Comments

Roman Tereshonkov - Dec. 2, 2011, 1:07 p.m.
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.

Signed-off-by: Roman Tereshonkov <roman.tereshonkov@nokia.com>
---
 drivers/mtd/mtdoops.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Artem Bityutskiy - Dec. 4, 2011, 2:24 p.m.
On Fri, 2011-12-02 at 15:07 +0200, Roman Tereshonkov wrote:
> 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.
> 
> Signed-off-by: Roman Tereshonkov <roman.tereshonkov@nokia.com>

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

Cc: stable@kernel.org

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

Patch

diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
index 1e2fa62..cea9279 100644
--- a/drivers/mtd/mtdoops.c
+++ b/drivers/mtd/mtdoops.c
@@ -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,