JFFS2 write performance boost ...

Oddjobz oddjob at linux.co.uk
Thu Dec 9 13:52:22 EST 2004


Hi,

Further to my previous email, I've managed to boost the write
performance by a factor of x 4, however I think there is an issue here
which probably needs at the very least some comment if not some
attention.

mkfs.jffs2 allows for a variable "erasesize" setting.
mtdblock   allows for a variable "erasesize" setting.
jffs2      should read this setting from the created filesystem.

Unfortunately, jffs2 uses a buffer to cache the erase structure in
memory and this cache is acquired using kmalloc - hence limited to 128k.
To make the erase structure fit into 128k, jffs2 dynamically resizes the
"erasesize" and sector count on the fly, thus you don't get the settings
you were looking for if you're using more flash than will "fit".

Indeed on my systems you get a fairly fast panic, more often than not.

Now I'm guessing this problem isn't apparent on small flash sizes,
however I'm working with 256Mb and it's a real show stopper - unless you
can live with a dribble write speed ..

Suggested solutions:
Solution 1: remove the erasesize option in the tools
Solution 2: allow a > 128k buffer for the erase structure
Solution 3: recode JFFS2 to use a more memory-efficient approach

I've removed the code from fs.c that scales the sector count and erase
size (all three lines) and changed the kmalloc in build.c to a vmalloc.
(and changes the kfree's to vfrees accordingly)

This "seems" to work just fine (?)

I now have a "proper" 8k erasesize (and I'm assuming other sizes will
work) and as a result instead of getting 29k/sec write speed, I'm
getting 117k/sec write speed.

[the erase structure eats 1.5Mb in this instance]

Thoughts ?

Gareth.
-- 
Oddjobz <oddjob at linux.co.uk>





More information about the linux-mtd mailing list