data loss on jffs2 filesystem on dataflash

Peter Menzebach pm at
Thu Sep 22 10:59:29 EDT 2005

Andrew Victor wrote:
> hi,
>>>Problem is here, how does the user get the information about the erase 
>>>size used by jffs2?
>>He detects that the flash is DataFlash (mtd->type == MTD_DATAFLASH). 
>>Afterwards he knows, that
>>1. mtd->erasesize is the size of DataFlash block
>>2. mtd->oobblock is the size of DataFlash page
> No.  You can't change mtd->erasesize.
> There are other existing applications that access the raw MTD layer and
> want the real erasesize.
I agree. The erase size reported to the mtd layer should be always the 
physical erase size (528/1056).

>>Sorry, didn't get it. I mean, MTD provide information about both 
>>DataFlash block size and DataFlash page size. That's obvious.
> This magic minimum block size could always be calculated in JFFS2 (in
> jffs2_dataflash_setup).  It is a JFFS2-specific value.
> Just calculate an 'N' where:
>    (N * mtd->erasesize) >= jffs2_minimum_block_size
> and
>    (mtd->size % (N * mtd->erasesize)) == 0

That would possible.
Set jffs2->wbuf_size to erasesize and calculate the jffs2->sector size 
as you outlined...

Best regards

Peter Menzebach
Menzebach und Wolff IT-Consulting GbR
Phone +49 751 355 387 1

More information about the linux-mtd mailing list