[JFFS2] Reduce excessive node count for syslog files.
authorDavid Woodhouse <dwmw2@infradead.org>
Sun, 14 May 2006 03:06:24 +0000 (04:06 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Sun, 14 May 2006 03:06:24 +0000 (04:06 +0100)
commitcf5eba53346fbfdf1b80e05ca3fd7fe2ec841077
tree22e24ce02de0ddd1c7a1113a59f0cac157aa9dab
parent151e76590f66f5406eb2e1f4270c5323f385d2e8
[JFFS2] Reduce excessive node count for syslog files.

We currently get fairly poor behaviour with files which get many short
writes, such as system logs. This is because we end up with many tiny
data nodes, and the rbtree gets massive. None of these nodes are
actually obsolete, so they are counted as 'clean' space. Eraseblocks can
be entirely full of these nodes (which are REF_NORMAL instead of
REF_PRISTINE), and still they count entirely towards 'used_size' and the
eraseblocks can sit on the clean_list for a long time without being
picked for GC.

One way to alleviate this in the long term is to account REF_NORMAL
space separately from REF_PRISTINE space, rather than counting them both
towards used_size. Then these eraseblocks can be picked for GC and the
offending nodes will be garbage collected.

The short-term fix, though -- which probably makes sense even if we do
eventually implement the above -- is to merge these nodes as they're
written. When we write the last byte in a page, write the _whole_ page.
This obsoletes the earlier nodes in the page _immediately_ and we don't
even need to wait for the garbage collection to do it.

Original implementation from Ferenc Havasi <havasi@inf.u-szeged.hu>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
fs/jffs2/file.c