[Yaffs] Optimizing the number of reads and writes to flash

Charles Manning manningc2@actrix.gen.nz
Wed, 13 Oct 2004 10:28:23 +1300


I think some of your questions might not have been answered properly.

On Tuesday 12 October 2004 01:46, Daniel Gustafsson wrote:
> I am using yaffs/direct and I want to reduce the reads and writes towar=
ds
> the flash to an absolute minimum. I do not want any verifications of fl=
ash
> etc. I don not want to use ECC.

If you do not want to use ECC, then set useNANDECC. This means that YAFFS=
=20
will not do the ECC checks on data and will rely on the media doing any E=
CC=20
checks itself. This can be used in situations where you want to avoid ECC=
=20
completely (eg. the ram-disk in int yaffscfg.c:yaffs_StartUp(void))

> Further more I am interested in some documetation what happens
> (reads/writes to flash) when performing some simple fs operations like
> read/write/open etc.

The biggest number of reads is on mount to scan the media.

Otherwise here's a brief run-down:
open(): Reads/writes nothing  unless this is a file creation. If it is a =
file=20
creeation then write a new object header.
flush()/close(): If the file is modified then writes an object header. Al=
so=20
flushes data in cache. If this is an overwrite, then needs to read and=20
overwrite old data.
read(): Reads data unless it is already in cache.
write(): Small writes (sub-page) go into cache otherwise go to flash.

unlink()/delete():  writes an object header to say that the object has be=
en=20
deleted. Data is cleaned up by garbage collection.

Garbage collection:
Reads data in block being collected. Writes useful stuff back to flash. E=
rase=20
flash (2ms).

-- Charles