Re: data loss on jffs2 filesystem on dataflash

Artem B. Bityutskiy
2005-09-20T16:32:48Z

Hi Andrew,

On Tue, 2005-09-20 at 17:11 +0200, Andrew Victor wrote:
> > In the code, I see at the moment only, that in the device driver
> > mtd_info.erasesize is set, later on in jffs2 I see, that this has become
> > the sector_size, which becomes then the wbuf_pagesize.
>
> To reduce the number of erase blocks, JFFS2 may also concatenate a
> number of erase-blocks in a 'virtual block'. That is what sector_size
> and wbuf_pagesize might get set to.
Yes, right. Albeit this is fixed, this doesn't matter.

The question is *why you set wbuf size = eraseblock size?* In case of
DataFlash, I assume, wbuf_size = DataFlash page size (the minimal
writing unit). Eraseblock size must be = DataFlash block size.

Yes, it is theoretically correct to set write buffer size = eraseblock
size, but this is *really* bad. This is wasteful (imagine, any sync will
will add lots of padding and waste the whole eraseblock).

And, the size wbuf has nothing to do with "concatenate number of
eraseblocks", whare is the relation?

> > Is here mtd_info.ooblock to be set?
>
> No. All bytes on a DataFlash device are directly addressable, so there
> is not really an OOB area.
Stop, mtd_info.ooblock is the size of NAND page in case of NAND. I would
read it as 'the size of block which contains OOB'. Agree, not very good
name.

So, I offered to fill mtd_info.ooblock by the size of DataFlash page,
and set.

Comments? Thanks.