How to determine MTD/JFFS2 RAM consumption

Zoltan Sogor weth at inf.u-szeged.hu
Wed Oct 12 09:46:58 EDT 2005


Hi!

Bernhard Priewasser wrote:

> - Why are there 64 jffs2_raw_node_refs after mounting an empty JFFS2?

If you are using NOR memory then there is a cleanmarker node in the
begining of every jeb and the scan process allocates a raw_node_ref for it.

> - Why are there 103 jffs2_raw_node_ref after writing 10 (small) files?

If you write a new file to the flash then it allocates a inode, dentry
and an other inode. Every dentry has an inode number to which it belongs
to, that's why jffs2 allocates the inode first and after then the
dentry. The second inode contains the writed data (if the compreessed
size of the data and the inode header is smaller than 4k ).
64 + 30 = 94
(What is about the other 9? I don't know exactly but if you send us the
testcase then maybe we can tell more)

> - What about jffs2_node_frag and jffs2_full_dnode?

Jffs2 builds up the full inode data by fragments (as on flash) and
builds a red-black tree (using the version number as key).
jffs2_node_frag stores the size of the fragment and the offset of the
fragment. Offset is the distance from the begining of the file.
jffs2_full_dnode is an extension of raw_node_ref.  Write_dnode returns a
full_dnode pointer, it contains the offset and the size of the written
data and a pointer to a raw node. From this information jffs2 can build
up the new fragment and add it to the fragment tree.

Zoltan





More information about the linux-mtd mailing list