On Wednesday 16 November 2011 16:20:47 张磊 wrote: > i'm reading the yaffs2's sourcecode,and i'm puzzling about the check point > mechnism. > 1.in struct yaffs_dev ,it's member checkpt_buffer,it seems storing > checkpoint data,and checkpt_byte_offs stores the offset of each check point > data.(i'm right?) in funciton write checkpoint to yaffs_dev and read > checkpoint from yaffs_dev,after write/read check point > data,checkpt_byte_offs always increace, this is why i'm puzzling,can > someone tell me why,thank very much. The checkpoint data is read or written as a stream. The checkpoint buffer is just a buffer used to hold the data to build up page aligned data. See the functions in yaffs_checkptrw.c. > 2.as the checkpoint data is not write to flash immediately,if suddenly the > device lost power and the checkpoint has not been synchronized while many > successful opeartion has down.then reboot the device ,how does yaffs2 work? > use the checkpoint data to recover or scan flash to recover? and how > yaffs2 detectes? If there is no valid checkpoint then yaffs scans the flash instead. This is detected by not finding any, or enough, checkpoint data when reading the checkpoint. -- Charles