All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kyungmin Park <kyungmin.park@samsung.com>
To: linux-mtd@lists.infradead.org
Cc: dwmw2@infradead.org
Subject: [PATCH][JFFS2] Fix mount error in case of MLC flash
Date: Wed, 12 Dec 2007 13:55:37 +0900	[thread overview]
Message-ID: <20071212045537.GA24490@party> (raw)

Even though we don't use the OOB, we should use the bad block information.
Also we read a whole eraseblock at a time.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index 272872d..91db883 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -111,7 +111,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
 	if (!flashbuf) {
 		/* For NAND it's quicker to read a whole eraseblock at a time,
 		   apparently */
-		if (jffs2_cleanmarker_oob(c))
+		if (c->mtd->type == MTD_NANDFLASH)
 			buf_size = c->sector_size;
 		else
 			buf_size = PAGE_SIZE;
@@ -448,22 +448,24 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
 	D1(printk(KERN_DEBUG "jffs2_scan_eraseblock(): Scanning block at 0x%x\n", ofs));
 
 #ifdef CONFIG_JFFS2_FS_WRITEBUFFER
-	if (jffs2_cleanmarker_oob(c)) {
+	if (c->mtd->type == MTD_NANDFLASH) {
 		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));
+		if (jffs2_cleanmarker_oob(c)) {
+			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;
-		default: 	return 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;
+			default: 	return ret;
+			}
 		}
 	}
 #endif

                 reply	other threads:[~2007-12-12  4:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071212045537.GA24490@party \
    --to=kyungmin.park@samsung.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.