On Thu, 21 Oct 2010 09:17:02 +1300 Charles Manning wrote: > On Wednesday 20 October 2010 17:41:35 黄柏一 wrote: > > Hi guys, > > > > Recently i want to do some research on yaffs. I have a question. I already > > set up a yaffs based flash memory using nandsim. Here i want to do the > > following things. I want to find the information about one specific chunk, > > for example, yaffs is setup by arrange many chunks, i give you a number N > > which is the number in the index. I want to find what is the chunkId, > > parentsId, belongs to which object for this N. Can some one help me to > > figure out this question? Thank you so much. > > Hello Alex > > For in depth information I suggest you first read this: > http://www.yaffs.net/files/yaffs.net/HowYaffsWorks.pdf > > The garbage collection code needs to do what you are asking about. It reads > the tags from the chunks in a block and then figures out what object it > belongs to. > > -- CHarles > Hi Charles, I also try to understand the data on the NAND with YAFFS2. I use a NANDSIM of 16MiB, pages/chunk size is 512B and OOB size is 16B, Linux 2.6.30, desktop computer. I have mounted the nandsim in YAFFS2 type and put 2 or 3 files and directories in. Then I use nanddump to get an image of the nandsim. I open the dump image with hex editor. The first chunk contains the object header of the first file. Its spare data at the address 0x200 are: FC 30 33 F3 FF FF 30 FF 00 00 10 00 05 01 04 00 I'm not sure but I think that these bytes are the data of a yaffs_PackedTags2 structure. So in that case I have: seq_number = 0xf33330fc obj_id = 0xff30ffff chunk_id = 0x00100000 n_bytes = 0x40105 Later, at the address 0x630 (which means the 4th chunk), I got another object header with the same file name. The spare data at the address 0x830 are below: FC 30 33 AA FF FF 56 5B 00 00 20 00 05 01 08 40 seq_number = 0xaa3330fc obj_id = 0x5b56ffff chunk_id = 0x200000 n_bytes = 0x40080105 When reading the document HowYaffsWorks.pdf, I understand that I have to scan backward with YAFFS2. So the first chunk should be obsolete because there is the 4th chunk. But the document and the .h files tell that if the chunk stores an object header, the chunk id should be null. The object ID should be also equal because it is the same object. This is not what I get from the dump. Do I use the right structure? Thanks. Bounlith Sirivong. > > > _______________________________________________ > yaffs mailing list > yaffs@lists.aleph1.co.uk > http://lists.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs owYaffsWorks.pdf