[JFFS2] a way to reduce memory usage

Dmitry Bazhenov dbazhenov at rambler.ru
Thu Jun 15 04:16:23 EDT 2006


Hello all!

As I understand, for the moment every reference to raw node is kept in-core,
even for obsoleted one. I think it is a bit excessive.

I have an idea how to reduce the amount of references kept in-core.
It requires some terminology: 

Raw nodes are classified as:
-	valid
	Node is still used. The block owning a valid node couldn't be erased.
-	significant
	A significant node is obsolete but we must consider it exists. The block
	owning a significant node can be erased. A significant node must be kept
	in memory until the owning block is erased.
-	insignificant
	A insignificant node is obsolete and may not be kept in memory any more.

As you can see, I introduced a new state of node "significant". The amount of
significant nodes is less than total amount, thus we can reduce memory usage
by releasing all references to insignificant nodes.

Below are the rules to determine validness/significance of a certain node.
I have made rules for dirent and data nodes only:
-	Node is "obsoleted in block" if it is obsoleted by
	subsequent nodes in the same block.
-	Node is "globally obsoleted" if it is obsoleted by
	subsequent nodes that are not in the same block.
-	Normal dirent or data node is valid if it is neither
	"globally obsoleted" nor "obsoleted in block".
-	Normal dirent or data node is significant if it is
	"globally obsoleted" but is not "obsoleted in block",
	and the block is not erased.
-	Deletion dirent is valid if it is neither "globally
	obsoleted" nor "obsoleted in block", and
	is not the only dirent in inode.
-	Deletion dirent is significant if it is the only
	dirent in inode and the block is not erased.

I think that the same rules can be applied to other kinds of nodes.

What do you think?

--
Dmitry




More information about the linux-mtd mailing list