A JFFS2 optimization related to syslog

Jörn Engel joern at wohnheim.fh-wedel.de
Tue Apr 18 08:05:27 EDT 2006


On Tue, 18 April 2006 15:46:22 +0400, Artem B. Bityutskiy wrote:
> Ferenc Havasi wrote:
> >Dear All,
> >
> >If JFFS2 is used as root filesystem, syslogd/klogd can cause problems,
> >because every log line are written out individually, so the log file
> >will contain a lot of small nodes. Because a log file can be very large
> >(over 30M in our case) it can cause large memory consuption and can make
> >the system very slow, especially at opening it after next reboot
> >(becauseof the large frag-tree). Unforunatelly garbage collecting also
> >does not help, because none of the nodes is obsocalated.
> Hmm,
> 
> for this testcase you actually want to write entire page if this is the 
> last page of this file. But your patch writes entire page if the current 
> fragment ends at the end of page, which is different.
> 
> I mean, you probably want to do something like this instead:
> 
> if ((inode->i_size >> PAGE_CACHE_SHIFT) >= pg->index) {
>     /*
>      * This is the last page, so unconditionally re-write it fully.
>      */
>     start = 0;
> }

When appending single bytes to a file, this would be rather wasteful,
wouldn't it?  Ferenc's trick is to rewrite the full page only when
completing it, not all the time.

But it might make sense to only add the optimization for the end of a
file, which catches the syslog case and misses others where the
optimization would hurt more than it helps.

Jörn

-- 
You ain't got no problem, Jules. I'm on the motherfucker. Go back in
there, chill them niggers out and wait for the Wolf, who should be
coming directly.
-- Marsellus Wallace




More information about the linux-mtd mailing list