Re: data loss on jffs2 filesystem on dataflash

Andrew Victor
2005-09-22T14:36:01Z

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.

> 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

Regards,
Andrew Victor