JFFS2 write performance boost ...

Gareth Bult (Local) gareth at linux.co.uk
Mon Dec 13 04:30:43 EST 2004


Further to my last email, many thanks to Jarkko Lavinen who pointed me
in the direction of "mtdblock" as opposed to JFFS2 itself re; the speed

Apparently mtdblock isn't too efficient .. raw tests give me;
Read: 2.5Mb/sec
Write: 30k/sec

I've now rewritten most of blkmtd.c to use standard buffering (thus
losing for now some of the direct bad block detection) and have the
speed up to;

Read: 7.5Mb/sec
Write: 5.4Mb/sec

(which is pretty much the USB key spec..)

I'm guessing with a little more work I can solve the bad block detection
issue and hopefully this will also improve the mount time ..


On Thu, 2004-12-09 at 18:52 +0000, Oddjobz wrote:
> 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.

More information about the linux-mtd mailing list