public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Sphinx King <alpharoot@gmail.com>
To: linux-mtd@lists.infradead.org
Subject: ext2 and fat32 can't handle bad block of nand flash?
Date: Sat, 17 Sep 2005 20:55:05 +0800	[thread overview]
Message-ID: <5b42f131050917055543f3d84f@mail.gmail.com> (raw)

Hi all,
It sounds like we can not use ext2 or fat32 file system on nand flash
if the nand flash has bad blocks.

My board has only one bad block which can be handled by mtd driver
because I saw message like "bad eraseblock ..." during linux booting
up. I've managed to use mke2fs to format the mtdblock as ext2
(although it has bad block). When I copy file to this partition, it
soulds like ext2 still attempts to write data to the bad block
although this bad block is already put into the mtd bad block table.
This finally results in I/O error and the write fails. I also tried
fat32 and got the same result.

After looking into the mtd code, I found the write request (which is
from the up layer) to the bad block is transfered to the function
do_cached_write() in mtdblock.c. In this function mtd might do a
cached_write after it receives data from up layer, ie., it attempts to
read out sector data and do buffering, which will be written back to
the block later. Here the problem comes out. Since the block is bad,
an ECC error occurs which results in the failure of the read. And the
do_cached_write() returns error to inform up layer. However it seems
the up layer will try to write to the bad block again and again
although the write fails. Finally the copy of file completes but the
file is corrupt.

Is my understanding correct? Why ext2 or fat32 trys to write to a bad
block? Can we use ext2 or fat on nand flash if the flash has bad
block?

By reading some doc I was told there is no such problem for jffs2
because jffs2 can handle bad block info. Is it true? Currently I
haven't try jffs2 yet. I will try it in some days.

Can anybody help me on this? Thanks in advance.

-- 
Sphinx

             reply	other threads:[~2005-09-17 12:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-17 12:55 Sphinx King [this message]
2005-09-19  9:19 ` ext2 and fat32 can't handle bad block of nand flash? Jörn Engel
     [not found]   ` <5b42f13105092000387cd0cc24@mail.gmail.com>
     [not found]     ` <20050920101524.GB2143@wohnheim.fh-wedel.de>
2005-09-20 10:36       ` Sphinx King

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=5b42f131050917055543f3d84f@mail.gmail.com \
    --to=alpharoot@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox