data loss on jffs2 filesystem on dataflash

Artem B. Bityutskiy dedekind at yandex.ru
Thu Sep 22 10:06:54 EDT 2005


Peter Menzebach wrote:
> But in this case mtd_info structure has to be changed/extended. 
> Otherwise the information does not get to the jffs2 layer. How 
> should/could this be managed?
Yes. As a hacky solution you may use mtd->oobblock to inform about 
DataFlash page size.

>>> IMHO the cleanest solution would be, that the dataflash/mtd layer
>>> reports it's true erase_size = smallest write size = 528/1056 bytes, and
>>> should not make a further guess about later use.
>>
>>
> 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

May be this is not the best solution. Consult tglx1.

> Are these two values typically existing? In the dataflash case, it's 
> only one value.
Sorry, didn't get it. I mean, MTD provide information about both 
DataFlash block size and DataFlash page size. That's obvious.

>>> -    if (SECTOR_ADDR(to) != SECTOR_ADDR(c->wbuf_ofs)) {
>>> +    if (PAGE_DIV(to) != PAGE_DIV(c->wbuf_ofs)) {
>>
>> Why this change ?
> 
> c->sector_size != c->wbuf_ofs
Of course.
c->sector_size = eraseblock size
c->wbuf_ofs - the absolute offset from the beginning of the partition 
where wbuf will be written.

The if() just check if JFFS2 switched to another eraseblock (because we 
are at the end of eraseblock and there is anyway too few space to write 
any node). So, SECTOR_ADDR() is absolutely correct. What's wrong?

> 
>>>      if (!c->mtd->block_markbad)
>>> -        return 1; // What else can we do?
>>> +        return 1;
>>
>>
>> Why this change ?
> 
> C++ comment
Well, it does not relate to the DataFlash stuff. It is generally good 
idea to send this as a distinct patch. But don't want to be an ass, so, 
let it be :-) Although dwmw2 is usually hit the celling when I edit his 
comments and I would prefer if you just change it to /* */ ... :-)

-- 
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.




More information about the linux-mtd mailing list