[Yaffs] Files lost on remount with arm linux and yaffs2

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Arvind Agrawal
Date:  
To: yaffs
Subject: [Yaffs] Files lost on remount with arm linux and yaffs2
Hi,

I am trying to use yaffs2 with arm linux and NAND Flash

Kernel Version 2.6.11.7
MTD from kernel - 2.6.17.11
YAFFS2

NAND Flash ST Micro 256 MB , large page, 2048 bytes, OOB 64 bytes


Nand subsystem works fine with JFFS2 but mounts become very slow ( minutes
instead of seconds) when the flash is even half full.

That's the reason , I am trying to use YAFFS2.

It works fine on first mount, I can copy and read files without any issue.
On remount, all the files are lost and only directory visible is
"lost+found".


On debugging YAFFS, I found couple of problems so far.

1. In file yaffs_mtdif2.c --> nandmtd2_ReadChunkWithTagsFromNAND()

If only tags are needed, functions calls mtd->read_oob(), which returns the
full OOB (64 bytes), including 2 bytes for BAD BLOCK marker, which throws
the TAGS2 by 2 bytes thus giving incorrect sequence no etc.
(This looks like fixed in mtd with linux 2.6.18 kernel as the read_oob()
returns the OOB with offset of 2 , skipping the BAD BLOCK bytes).

Fix : for Tags only option copy the spare buffer at ofsfet 2 to the TAG2
pointer pt.

After this fix I can see the copied files

But then ran into the second issue, seems a bit more obscure though

2. But with the above fix, on mounts (even with fresh Flash_eraseall ), i
get
"Freechunks verification failure"
With a partition of 4 MB and 20 Checkpoint blocks, I get

Freechunks verification failure 9741 1792 7949

On debuggin this, I found that,

While debugging withYAFFS2, some blocks were marked BAD in the checkpoint
area ( block 1, 2, 3, 4)..

Checkpointing function, yaffs_CheckpointFindNextCheckpointBlock()
directly calls readChunkswithTagsFromNAND(), this function always returns
OOB data even if the BLOCK is BAD

and Since it found some good data in a BLOCK, MARK BAD, from previous
checkpoint writes, it throws off the
dev->nFreeChunks which now initializes to 7949 ( the difference in
verification failure message above)...


Any ideas, for how to approach the above issues ??

Any help is greatly appreciated..

thanks,

Arvind