Question about mkfs.jffs2 "-s" option

Grant Edwards grant.b.edwards at gmail.com
Thu May 3 14:21:54 EDT 2012


On 2012-05-03, Shmulik Ladkani <shmulik.ladkani at gmail.com> wrote:
> Hi Ricard,
> 	
> On Thu, 3 May 2012 09:35:14 +0200 (CEST) Ricard Wanderlof <ricard.wanderlof at axis.com> wrote:
>> 
>> On Wed, 2 May 2012, Grant Edwards wrote:
>> 
>> > The NAND flash I'm using has to be written in 4K blocks -- isn't that
>> > the "page size"?
>> 
>> 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,

It would be cool if that's what the man page actually said. :)

>> 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.

To me, that's the obvious interpretation of the man page, and I swear
I've read "howto" pages at other sites (probably ARM SoC and
eval-board vendors), that explictly told you to set the -s option to
be the flash device's page size.

> Can you tell what's the effect of incorrectly setting it to values
> such as: 512 or 2048 bytes (instead of 4KiB)?
>
> Well, I guess as data is written during runtime by the jffs2 itself,
> and as the GC gets working, new inodes will be correctly created, and
> their sizes will be up to system's page size.
>
> However what happens with these small inodes initially created by
> mkfs.jffs2? "Only" a performance penalty or something worse?

When I created them with 4 byte nodes, the filesystem seemd to work
fine.  It was just shockingly large. :)

-- 
Grant Edwards               grant.b.edwards        Yow! TAILFINS!! ... click
                                  at               ...
                              gmail.com            




More information about the linux-mtd mailing list