mtd: mtdoops: skip reading initially bad blocks

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Jan 9 13:59:05 EST 2012


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=3538c56329936c78f7d356889908790006d0124c
Commit:     3538c56329936c78f7d356889908790006d0124c
Parent:     2f4478ccff7df845dc9c0f8996a96373122c4417
Author:     Roman Tereshonkov <roman.tereshonkov at nokia.com>
AuthorDate: Fri Dec 2 15:07:17 2011 +0200
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Mon Jan 9 18:12:47 2012 +0000

    mtd: 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.
    
    Cc: stable at kernel.org
    Signed-off-by: Roman Tereshonkov <roman.tereshonkov at nokia.com>
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/mtdoops.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

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,



More information about the linux-mtd-cvs mailing list