diff mbox

mtdoops: skip reading initially bad blocks

Message ID 1322831237-22044-1-git-send-email-roman.tereshonkov@nokia.com
State Accepted
Commit 3538c56329936c78f7d356889908790006d0124c
Headers show

Commit Message

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

Comments

Artem Bityutskiy Dec. 4, 2011, 2:24 p.m. UTC | #1
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!
diff mbox

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,