Question about mkfs.jffs2 "-s" option

Shmulik Ladkani shmulik.ladkani at gmail.com
Fri May 4 08:00:01 EDT 2012


Hi Artem, Ricard,

On Fri, 04 May 2012 10:15:37 +0300 Artem Bityutskiy <dedekind1 at gmail.com> wrote:
> On Thu, 2012-05-03 at 21:13 +0300, Shmulik Ladkani wrote:
> > On Thu, 3 May 2012 09:35:14 +0200 (CEST) Ricard Wanderlof <ricard.wanderlof at axis.com> wrote:
> > > 
> > > The smallest writable unit in a NAND flash is called a 'page', but AFAIK 
> > > this is not what the -s option in mkfs.jffs2 is for. Instead, it is 
> > > related for the kernel memory managament page size, which is 4k for most 
> > > architectures.
> > 
> > According to MKFS.JFFS2(1),
> > 
> > 	-s, --pagesize=SIZE
> > 		Use page size SIZE.  The default is 4 KiB.  This size is
> > 		the maximum size of a data node.
> > 
> > And according to http://linux-mtd.infradead.org/~dwmw2/jffs2.pdf
> > 
> > 	In order to facilitate rapid decompression of
> > 	data upon readpage() requests, nodes contain
> > 	no more than a single page of data, according to
> > 	the hardware page size on the target platform.
> > 
> > Wow.
> > I always assumed I had to set it according to NAND's page size, not
> > according to target system's mm page size.
> 
> Shmulik, I can give some info about this. First of all because of
> compression and very different node sizes (UBIFS and JFFS2) and because
> JFFS2 was designed for NOR flash originally - NAND page size is not
> something which affects the design of file-systems, or their on-flash
> layout. We use write-buffers on I/O level to make it appear like the
> eraseblock is byte-writable.
> 
> The RAM page size comes from the general linux design - the VFS writes
> in RAM page size units, and it is much simpler to make max node size =
> PAGE_CACHE_SIZE rather than trying to split it when the PAGE_CACHE_SIZE
> is something like 16KiB. This is where this -s stuff comes from. I think
> it was a mistake to introduce this parameter because it is very unlikely
> JFFS2 is/was used on systems with a different PAGE_CACHE_SIZE.

Thanks for the explanations.
I pretty much realized this after reading [1]...

BTW, googling [mkfs.jffs2 and "-s 0x200"] or [mkfs.jffs2 and "-s 0x800"]
yielded few howtos, faqs, and alike....
Guess I wasn't the only one fooled by the argument's name :-))

[1] http://linux-mtd.infradead.org/~dwmw2/jffs2.pdf

Regards
Shmulik



More information about the linux-mtd mailing list