public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* NAND flash and JFFS(2)
@ 2002-02-05 14:41 Veli-Pekka Ylönen
  2002-02-05 15:30 ` David Woodhouse
  0 siblings, 1 reply; 20+ messages in thread
From: Veli-Pekka Ylönen @ 2002-02-05 14:41 UTC (permalink / raw)
  To: linux-mtd

I read TODO file in JFFS2 sources and found this:

- NAND flash support:
    - Fix locking in jffs2_garbage_collect_deletion_dirent().
    - Move CLEANMARKER into the 'spare' area.
    - Write batching - build up a NAND-page worth of data and write out all in
	one go, using the hardware ECC or block-based software ECC. This gives us
	some interesting problems, but it's not that bad:
    - When we go to erase a block from which we've been garbage-collecting,
	  we have to make sure that the nodes in it _really_ are obsolete, and
	  the new node which finally obsoletes the block we want to erase isn't
	  still waiting in the write-buffer. We can do this by sticking such
	  blocks not on the erase_pending_list, but on a new erase_pending_wbuf
	  list, and then moving them to the erase_pending_list when the buffer is
	  flushed.
        - fsync() becomes a non-NOP.
	- Deal with write errors. Data don't get lost - we just have to write
	  the affected node(s) out again somewhere else.



Is somebody already working on this?

I read also in the archive that JFFS should support NAND. Is this true?
I have made the raw NAND interface work but JFFS and JFFS2 doesn't
do the batching and tries to write multiple times to same
page.

^ permalink raw reply	[flat|nested] 20+ messages in thread
[parent not found: <02020523405103.11497@thomas>]
* Re: NAND flash and JFFS(2)
@ 2002-02-11 15:32 Thomas Gleixner
  2002-02-11 15:48 ` Thomas Gleixner
  0 siblings, 1 reply; 20+ messages in thread
From: Thomas Gleixner @ 2002-02-11 15:32 UTC (permalink / raw)
  To: linux-mtd; +Cc: jffs-dev

On Monday, 11. February 2002 14:53, David Woodhouse wrote:
> Where's the ECC when we're using the SmartMedia format on them?

The layout for SmartMedia DOS for 256 byte pagesize:

Even page:
Byte 0-3	reserved area
Byte 4		data status flag
Byte 5		block status flag (bad block marker)
Byte 6-7	block adress 1

Odd page:
Byte 0-2 	ECC Area-2 (odd page)
Byte 3-4	Block Address 2
Byte 5-7	ECC Area-1 (even page)

The layout for SmartMedia DOS for 512 byte pagesize:
Byte 0-3	Reserved Area
Byte 4		Data Status Flag
Byte 5		block status flag (bad block marker)
Byte 6-7	Block Address-1
Byte 8-10 	ECC Area-2 (byte 256-511)
Byte 11-12	Block Address 2
Byte 13-15	ECC Area-1 (byte 0-255)

They build a virtual blocksize of 512 byte on the small devices. I thought
about doing the same, but IMHO it's not a good idea.

> Either way, you mustn't ever erase a block which is marked bad, right?

The datasheet says it's not allowed to do this, due to the fact, that you
loose bad block information and maybe you can't write the bad block info
again. So you would run always into this bad block after restart.

Sorry, as you see above, i had some trouble to count. The bad block status on
SmartMedia is not at Byte 6 it's at Byte 5. We want to keep it there, so we
have to split the ECC data on 512 byte devices.
SmartMedia and raw NAND 512 byte pagesize
Byte 0-3	ECC part 1
Byte 4		page data valid flag
Byte 5		bad block status
Byte 6-7 	ECC part 2
Byte 8-15	cleanmarker

SmartMedia and raw NAND 256 Byte pagesize
Byte 0-2	ECC
Byte 3-4	cleanmarker
Byte 5		bad block status
Byte 6		page data valid flag
Byte 7		spare

Please let me know, if we can fix this layout. Then i would implement and
test it.

> Cool. Does this leave some files on the fs and make lots of GC happen, and
> check the contents of all files on restart? Vipin's tests did this quite
> well, IIRC.

I have some files untouched on the fs. I check them with diff after reboot.
There was no failure.

> Now I suppose we need to look at using write_super and sb->s_dirt the way
> that God intended, for flushing pending writes in the wbuf rather than
> just triggering erases.

What do you mean exactly and what about the cleanup, when we fail during
flush_wbuf ?

Thomas
__________________________________________________
Thomas Gleixner, autronix automation GmbH
auf dem berg 3, d-88690 uhldingen-muehlhofen
fon: +49 7556 919891 , fax: +49 7556 919886
mail: gleixner@autronix.de, http://www.autronix.de  

^ permalink raw reply	[flat|nested] 20+ messages in thread
* Re: NAND flash and JFFS(2)
@ 2002-02-11 23:42 Steve_Chen
  2002-02-12  0:10 ` Thomas Gleixner
  0 siblings, 1 reply; 20+ messages in thread
From: Steve_Chen @ 2002-02-11 23:42 UTC (permalink / raw)
  To: gleixner; +Cc: David Woodhouse, jffs-dev, linux-mtd

Hi Thomas,
I have two questions regarding the layout scheme in oob.

1. What does "page data valid flag" mean ?  How do you use it ?
2. If jffs2 detects a bad block, does it set a flag in one of the bytes in
oob ?  I suppose we don't want to use byte 05 (bad block status) which was
set by the chip manufacturer.

Thanks.

Regards,
Steve




Thomas Gleixner <gleixner@autronix.de>@axis.com on 02/11/2002 11:28:09 AM

Please respond to gleixner@autronix.de

Sent by:  owner-jffs-dev@axis.com


To:   David Woodhouse <dwmw2@infradead.org>
cc:   jffs-dev@axis.com, linux-mtd@lists.infradead.org

Subject:  Re: NAND flash and JFFS(2)

On Monday, 11. February 2002 16:48, Thomas Gleixner wrote:

> I reflected this question again and we should do this very careful before
> implemetation. If we choose the same layout, somebody would be able to
> implement the SmartMedia DOS fs on top of SmartMedia and raw NAND flash.
> I personally have not interest in this fs, it's ok for MP3 players and
> digicams but not for industrial use.

I had a look at the nand driver, where we have to do some changes anyway to

support a different ECC address. To get the flexibility to use either a
JFFS2
specific ECC scheme or a different scheme like the SmartMedia DOS-FAT i
will
add a array to the nand structure, which holds the positions of the ECC
bytes
inside the spare area and a flag, which can be used to support the virtual
pagesize of 512 Byte for small NAND devices (if anybody is going to
implement
this).
The filesystem driver can set the ECC byte positions, so they match it's
requirements. We could add config options to select a default ECC scheme,
so
we have access to the chip as char device too. I'm not sure if we need this

really.
So we have the flexibility to do what we want and we don't prevent anybody
from implementing a different system.

I will try it with the following scheme tonight:

SmartMedia and raw NAND 512 byte pagesize
Byte 0-3        ECC part 1
Byte 4           page data valid flag
Byte 5           bad block status
Byte 6-7        ECC part 2
Byte 8-15      cleanmarker

SmartMedia and raw NAND 256 Byte pagesize
Byte 0-2        ECC
Byte 3           spare
Byte 4           page data valid flag
Byte 5           bad block status
Byte 6-7        cleanmarker

I have both card types so i can verify that it works.

Thomas
__________________________________________________
Thomas Gleixner, autronix automation GmbH
auf dem berg 3, d-88690 uhldingen-muehlhofen
fon: +49 7556 919891 , fax: +49 7556 919886
mail: gleixner@autronix.de, http://www.autronix.de

To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to majordomo@axis.com



^ permalink raw reply	[flat|nested] 20+ messages in thread
* RE: NAND flash and JFFS(2)
@ 2002-02-13 20:03 Lance Nakamura
  2002-02-13 20:19 ` Thomas Gleixner
  0 siblings, 1 reply; 20+ messages in thread
From: Lance Nakamura @ 2002-02-13 20:03 UTC (permalink / raw)
  To: gleixner, David Woodhouse; +Cc: linux-mtd, jffs-dev

2 things:
1) can the test be set to remove power more frequently,
   as in every minute rather than every hour?  our experience with
   power fail safety is that you have to run at least 100K cycles, preferably
   over a number of different units with parts from different manufactures,
   in order to have reasonable confidence.  that's probably something left
   to product implementors and not the current developers.  however, there is
   the order of magnitude rule that says everytime you get an order of magnitude
   more experience, you find another layer of problems.  a thousand cycles 
   would be pretty easy to come by on your setup if you can get random power
fails
   every minute or so, and that would yield a very high level of confidence
   at this stage of development.

2) an important test is to remove power while the file
   system is trying to recover.  in the real world, power failures
   are rarely clean, isolated instances.  you may get multiple failures in
   as little as 1 second (failures a few hundred miliseconds apart).


-----Original Message-----
From: Thomas Gleixner [mailto:gleixner@autronix.de]
Sent: Wednesday, February 13, 2002 1:41 AM
To: David Woodhouse
Cc: linux-mtd@lists.infradead.org; jffs-dev@axis.com
Subject: Re: NAND flash and JFFS(2)


On Tuesday, 12. February 2002 18:47, Thomas Gleixner wrote:
>
> Actual state of JFFS2 on NAND
>
> I will run some more tests tonight.
Excellent test result. 

Test is as follows:

SmartMediaCard: 16MB two partitions a 8MB
1st partition is root
2nd partition is data

data contains 20 files, which are not touched.

3 tasks running in loops

task 1: 
	copy 40 files from root to data, remove the files on root
	diff against original files on nfs
	copy 40 files from data to root, remove the files on data
	diff against original files on nfs
task 2:
	open file A on data for write every 1 sec. 
	append 1000 bytes and close the file 
	loop until filesize is >1MB
	open file B on data for write every 1 sec. 
	append 1000 bytes and close the file 
	loop until filesize is >1MB
task3:	
	wait until A is >1MB
	copy file A to nfs
	check file integrity of A
	remove file A on data
	wait until B is >1MB
	copy file B to nfs
	check file integrity of B
	remove file B on data

A independent control removes power after ~ 1-2 hours without warning.
After reboot:
The untouched 20 files on data are diffed against the original files on nfs
The 40 files, which are shuffeld between root and data are diffed against 
original files on nfs.
task1 starts
task2 takes the file, which was filled at last and starts
task3 starts

The test ran for 8 hours without any problem.

Thomas 
__________________________________________________
Thomas Gleixner, autronix automation GmbH
auf dem berg 3, d-88690 uhldingen-muehlhofen
fon: +49 7556 919891 , fax: +49 7556 919886
mail: gleixner@autronix.de, http://www.autronix.de  


To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to majordomo@axis.com

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2002-02-13 20:07 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-05 14:41 NAND flash and JFFS(2) Veli-Pekka Ylönen
2002-02-05 15:30 ` David Woodhouse
2002-02-05 17:28   ` Thomas Gleixner
2002-02-05 21:18     ` David Woodhouse
2002-02-05 17:35   ` Veli-Pekka Ylönen
     [not found] <02020523405103.11497@thomas>
2002-02-06  4:54 ` David Woodhouse
2002-02-06 22:47   ` Thomas Gleixner
2002-02-06 22:55     ` David Woodhouse
2002-02-07  6:51       ` Thomas Gleixner
2002-02-07  7:04         ` David Woodhouse
2002-02-11 13:42           ` Thomas Gleixner
2002-02-11 13:53             ` David Woodhouse
     [not found]               ` <0202121847440K.00764@thomas>
2002-02-13 11:40                 ` Thomas Gleixner
  -- strict thread matches above, loose matches on Subject: below --
2002-02-11 15:32 Thomas Gleixner
2002-02-11 15:48 ` Thomas Gleixner
2002-02-11 19:28   ` Thomas Gleixner
2002-02-11 23:42 Steve_Chen
2002-02-12  0:10 ` Thomas Gleixner
2002-02-13 20:03 Lance Nakamura
2002-02-13 20:19 ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox