[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to behave nicely on JFFS2

On Wed, 2003-10-15 at 11:45 -0700, David wrote:
> Hello all
> We are developing/porting some software onto an
> embedded system that will have 32MB flash based on
> Intel chips with a JFFS2 file system on it. My
> question is what pattern of
> read,write,insert,delete,... operations does JFFS2
> like and dislike ??

Write full pages as much as possible. Don't rewrite data which were
already present, if it can be avoided.

For example, traditional mbox format mailboxes are insane. Maildir is
much better.

> Basically how must applications behave in order to not
> cause too much wasted space in terms of fragmentation
> and the overhead that comes with it or to avoid
> putting the file system in a state that makes it less
> efficient/slower ?
> Example of questions that come to mind for me are :
> 1. Should data be stored in memory until its a certain
> amount before it is appended to a file ?  

Try to write in page-aligned page-sized chunks. 

> 2. Is it better to delete and rewrite a file then to
> update a portion of a file ???

Absolutely not. Update a portion instead.

Think of it as if someone is painstakingly writing down a log of every
change you make to the file system. 

 - 'unlink XXX from the directory with ino# YYY'
 - 'write these 5 bytes to offset XXXX in file ino# ZZZZ...'
 - 'write these 4096 bytes to offset WWWW in file ino# ZZZZ...'

Strive to ensure that there are as few such log entries as possible.


To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to majordomo@xxxxxxx.com