[Yaffs] Reducing footprint in RAM

Charles Manning manningc2@actrix.gen.nz
Tue, 12 Oct 2004 11:16:05 +1300


On Tuesday 12 October 2004 04:13, Daniel Gustafsson wrote:
> I am using yaffs/direct.
>
> I need to reduce the footprint in RAM a lot (maybe by not storing the
> complete tnode-list in RAM and increasing pagesize etc.). Any suggestio=
ns
> how to do that???
>
> If you restart the system and you have a flash memory of 1GB, does the =
file
> system then have to read the whole memory to create the original state?=
??
>
> I need as much information as possible to establish a good starting poi=
nt
> before trying to optimize.
>

When I designed YAFFS I tried to keep the footprint as low as I could. I=20
believe that YAFFS uses less RAM than any comparable file system.=20

At present yaffs uses a bit over 4kbytes per 1Mbytes of flash. When you g=
et=20
into hundreds of MBytes of NAND, this can add up to quite a lot.

Most of the RAM is used by the Tnode tree. Each "leaf" on the tree is a U=
16=20
for each "chunk" (ie.512 bytes) of NAND that is currently in a file.=20

YAFFS2 (in late development) allows you to use larger chunks. So if you u=
se,=20
say, 4kbyte chunks then you only need approx one eighth of the RAM since=20
there will be one eighth the number of chunks for the same flash size.

If you can think of useful ways to reduce RAM footprint, I would be more =
than=20
willing to listen.

When the file system is mounted, the whole NAND is scanned to build up th=
e=20
state. This scanning reads just the spare areas in NAND where all the tag=
s=20
are kept. Empty blocks do not need to be scanned. This takes some time, b=
ut=20
again I believe this to be faster than any other comparable file system.

It is possible to do some sort of "checkpointing" scheme that would save =
away=20
the information so that  it could be retrieved on remount without having =
to=20
scan the whole NAND. However, that's going to require some development :-=
).

-- Charles