What abount NAND driver in current MTD snapshot?

David Woodhouse dwmw2 at infradead.org
Fri Sep 7 04:48:02 EDT 2001

kernelhacker at hartford.siteprotect.co.kr said:
> I've just looked up MTD NAND driver for recent several days.
> I think it's almost done. But the driver itself has no bad block
> handling.

> Is it right? If it is right, where is the bad block handling?

The hardware driver itself has no bad block handling, yes - that should be 
done in the next layer up. Each format which you might put onto a NAND 
flash may have its own way of dealing with bad blocks. 

> Is NFTL capable of handling bad block? 

The NFTL format is capable of dealing with bad blocks, yes. But I don't
believe the Linux code currently does so with blocks which go bad at
runtime, only blocks which are marked bad during the initial format. A 
relatively simple exercise for the reader :)

> then, Can I use NAND driver & NFTL combined and put any filesystem on
> it? 

Technically, yes. But you probably shouldn't use NFTL. 

Firstly, as Kira says, NFTL suffers from patent problems, so you may find
it's not legal to use it. I'm not sure whether the M-Systems patents are
valid in Korea. 

More importantly, I think NFTL is just the wrong approach to putting a 
filesystem on a flash chip. NFTL is a form of pseudo-filesystem, used to 
emulate a block device. On top of that filesystem, you're going to have to 
put another journalling filesystem, like ext3. It is far more efficient 
just to put a filesystem directly on the flash chips. 

I think the best approach would be to add the necessary support for NAND 
chips to the JFFS2 code. Getting JFFS2 to deal with the 10-write-per-page 
restriction should be fairly simple, and the bad block code in JFFS2 is in 
much the same state as that in the NFTL code - we can deal with bad blocks 
appropriately but don't yet actually detect bad blocks and mark them as 
such. So if you're going to add badblock detection code, you might as well 
add it to JFFS2.


More information about the linux-mtd mailing list