From a7a6ace1406f95c3edb8365788f85984377f3832 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Wed, 31 Jan 2007 11:38:53 +0200 Subject: [JFFS2] Use MTD_OOB_AUTO to automatically place cleanmarker on NAND Nowadays MTD supports an MTD_OOB_AUTO option which allows users to access free bytes in NAND's OOB as a contiguous buffer, although it may be highly discontinuous. This patch teaches JFFS2 to use this nice feature instead of the old MTD_OOB_PLACE option. This for example caused problems with OneNAND. Now JFFS2 does not care how are the free bytes situated. This may change position of the clean marker on some flashes, but this is not a problem. JFFS2 will just re-erase the empty eraseblocks and write the new (correct) clean marker. Signed-off-by: Artem Bityutskiy Signed-off-by: David Woodhouse --- fs/jffs2/scan.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'fs/jffs2/scan.c') diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c index 3af746eaff0..31c1475d922 100644 --- a/fs/jffs2/scan.c +++ b/fs/jffs2/scan.c @@ -450,16 +450,20 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo #ifdef CONFIG_JFFS2_FS_WRITEBUFFER if (jffs2_cleanmarker_oob(c)) { - int ret = jffs2_check_nand_cleanmarker(c, jeb); + int ret; + + if (c->mtd->block_isbad(c->mtd, jeb->offset)) + return BLK_STATE_BADBLOCK; + + ret = jffs2_check_nand_cleanmarker(c, jeb); D2(printk(KERN_NOTICE "jffs_check_nand_cleanmarker returned %d\n",ret)); + /* Even if it's not found, we still scan to see if the block is empty. We use this information to decide whether to erase it or not. */ switch (ret) { case 0: cleanmarkerfound = 1; break; case 1: break; - case 2: return BLK_STATE_BADBLOCK; - case 3: return BLK_STATE_ALLDIRTY; /* Block has failed to erase min. once */ default: return ret; } } -- cgit v1.2.3