* ext2 and fat32 can't handle bad block of nand flash?
@ 2005-09-17 12:55 Sphinx King
2005-09-19 9:19 ` Jörn Engel
0 siblings, 1 reply; 3+ messages in thread
From: Sphinx King @ 2005-09-17 12:55 UTC (permalink / raw)
To: linux-mtd
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ext2 and fat32 can't handle bad block of nand flash?
2005-09-17 12:55 ext2 and fat32 can't handle bad block of nand flash? Sphinx King
@ 2005-09-19 9:19 ` Jörn Engel
[not found] ` <5b42f13105092000387cd0cc24@mail.gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Jörn Engel @ 2005-09-19 9:19 UTC (permalink / raw)
To: Sphinx King; +Cc: linux-mtd
On Sat, 17 September 2005 20:55:05 +0800, Sphinx King wrote:
>
> 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.
You only got what you deserved. Running a hard disk filesystem on raw
NAND without a sophisticated translation layer will kill your flash
chips in no time. For an introduction, you might want to read this:
http://www.linux-kongress.org/2005/abstracts.html#4_4_2
http://wh.fh-wedel.de/~joern/logfs.pdf
Then you should rethink your setup and possibly come back.
Jörn
--
You can take my soul, but not my lack of enthusiasm.
-- Wally
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ext2 and fat32 can't handle bad block of nand flash?
[not found] ` <20050920101524.GB2143@wohnheim.fh-wedel.de>
@ 2005-09-20 10:36 ` Sphinx King
0 siblings, 0 replies; 3+ messages in thread
From: Sphinx King @ 2005-09-20 10:36 UTC (permalink / raw)
To: Jörn Engel; +Cc: linux-mtd
On 9/20/05, Jörn Engel <joern@wohnheim.fh-wedel.de> wrote:
> On Tue, 20 September 2005 15:38:52 +0800, Sphinx King wrote:
> > Thanks for your link. I prefer FAT32 because this MTD partition will
> > be mounted to Windows PC through USB mass storage so that data can be
> > transfered between the board and PC. By reading doc it sounds like I
> > need to add translation layer between MTD and FAT32. But I could not
> > find the howto doc on FTL/NFTL in the net or archive. Could you please
> > provide any links? Besides, the NFTL is patented as described in the
> > kerel config, there will be problems if I use it in my product?
>
> If you have a USB key, you should already have some FTL hidden inside
> the device. Just use the USB mass storage driver and run FAT on the
> block device.
>
> If that strategy doesn't work, your USB key is broken in some way. In
> that case, you should look for a different supplier.
>
If there is FTL inside the device, I believe it is just the
/dev/mtdblock/4. On my board the /dev/mtdblock/4 is mounted to PC
through USB mass storage, and PC can format it as FAT32 but it is not
stable due to the bad block.
On the board this mtd block is also mounted under linux (mount -t vfat
/dev/mtdblock/4 /datadisk). Under linux it is not stable yet. So I
think I should find something than mtdblock to make FAT32 work.
My USB module is ok because the stability problem happens only when
the data was being written to the bad block of nand flash.
--
Sphinx
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-09-20 10:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-17 12:55 ext2 and fat32 can't handle bad block of nand flash? Sphinx King
2005-09-19 9:19 ` Jörn Engel
[not found] ` <5b42f13105092000387cd0cc24@mail.gmail.com>
[not found] ` <20050920101524.GB2143@wohnheim.fh-wedel.de>
2005-09-20 10:36 ` Sphinx King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox