diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2007-01-31 04:38:53 -0500 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2007-02-09 10:34:08 -0500 |
commit | a7a6ace1406f95c3edb8365788f85984377f3832 (patch) | |
tree | 852a51608c1e2f437786750ca326ee8ce4b61364 /fs/jffs2/scan.c | |
parent | 73a4421c5a0aa77b996891e7616b396c360b3ed8 (diff) |
[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 <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs/jffs2/scan.c')
-rw-r--r-- | fs/jffs2/scan.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c index 3af746eaff0e..31c1475d922a 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 | |||
450 | 450 | ||
451 | #ifdef CONFIG_JFFS2_FS_WRITEBUFFER | 451 | #ifdef CONFIG_JFFS2_FS_WRITEBUFFER |
452 | if (jffs2_cleanmarker_oob(c)) { | 452 | if (jffs2_cleanmarker_oob(c)) { |
453 | int ret = jffs2_check_nand_cleanmarker(c, jeb); | 453 | int ret; |
454 | |||
455 | if (c->mtd->block_isbad(c->mtd, jeb->offset)) | ||
456 | return BLK_STATE_BADBLOCK; | ||
457 | |||
458 | ret = jffs2_check_nand_cleanmarker(c, jeb); | ||
454 | D2(printk(KERN_NOTICE "jffs_check_nand_cleanmarker returned %d\n",ret)); | 459 | D2(printk(KERN_NOTICE "jffs_check_nand_cleanmarker returned %d\n",ret)); |
460 | |||
455 | /* Even if it's not found, we still scan to see | 461 | /* Even if it's not found, we still scan to see |
456 | if the block is empty. We use this information | 462 | if the block is empty. We use this information |
457 | to decide whether to erase it or not. */ | 463 | to decide whether to erase it or not. */ |
458 | switch (ret) { | 464 | switch (ret) { |
459 | case 0: cleanmarkerfound = 1; break; | 465 | case 0: cleanmarkerfound = 1; break; |
460 | case 1: break; | 466 | case 1: break; |
461 | case 2: return BLK_STATE_BADBLOCK; | ||
462 | case 3: return BLK_STATE_ALLDIRTY; /* Block has failed to erase min. once */ | ||
463 | default: return ret; | 467 | default: return ret; |
464 | } | 468 | } |
465 | } | 469 | } |