Understanding page size in jffs2- and kernel-source

Ricard Wanderlof ricard.wanderlof at axis.com
Tue Oct 18 04:32:07 EDT 2011


On Mon, 17 Oct 2011, Freise, Bjoern-Achim wrote:

> Hello,
>
> we are using Kernel 2.6.28 with mtd-utils 1.0.1 on an ARM at91sam9260 
> with a NAND flash with 512 byte pages an 16k erase size. And now I'm 
> trying to understand a few things:
>
> 1) In the kernel source it has PAGE_SIZE and PAGE_CACHE_SIZE with 4096. 
> These defines are used in the jffs2 implementation. Is that correct when 
> using 512 byte pages in a NAND device?

The PAGE_SIZE used in the kernel (4096 in this case) has no relation to 
the page size of the NAND flash device. The kernel PAGE_SIZE is related
to the memory managment and is usually fixed for a given CPU architecture.

The NAND flash page size is the smallest programmable unit in the flash.

> 2) In our build-environment our image is created with "mkfs.jffs2 .... 
> --page-size=512.... ". I guess this doesn't match with the above?

The page size you specify to mkfs.jffs2 is the size of the flash device.

(Just a note: There are however file systems such as cramfs where the page 
size specified in the kernel is also used when creating the file system.)

> 3) What should I use for a good performance (page_size and/or with/out 
> compression) when using a large (~ 16MB) sqlite-file?

By performance I assume you mean transfer rate?

I'm not sure about this, but I would expect that it depends on how fast 
your system's nand flash interface is. With compression on, the system has 
to spend time compressing/decompressing, on the other hand, there is less 
data to be transfered to/from the flash. With compression off, there's 
more data, but no time has to be spent compressing/decompressing. If you 
have a fast CPU but slow nand flash interface I would expect compression 
would be beneficial.

Easiest would be just to try this out.

/Ricard
-- 
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30



More information about the linux-mtd mailing list