Author: Robin Iddon Date: To: yaffs Subject: [Yaffs] Checkpointing question.
Hi,
We have recently ported Yaffs to a ATMEL AT91SAM9261EK using a Samsung
K9F2G08U0M 2Gbit NAND FLASH device.
We're running C straight on the processor for this application, so no
O/S to speak of.
We have provided the various routines YAFFS needs to run on this
platform and it does appear to be working, so thanks!
However, I have one question about checkpointing - I cannot decide if
it's working properly or not. If you look at the output below you'll
see there's a "bad sequence" error I am concerned with, and also I
wanted to understand if the initial scan (and resulting
"isCheckpointed:0") is correct?
Our test consists of Startup/mount/open/read+write/close/unmount and
these all work (i.e. data is saved/read and no error returns). In this
case we're just writing 10 bytes to a single test file in the first run
and reading them back in the second and nothing else; we started with an
otherwise erased FLASH device (excepting for the pre-marked bad blocks).
Looking at the debugging output we see at startup/mount (extra comments
in <>):
yaffs: yaffs_GutsInitialise()restore entry: isCheckpointed 0
find next checkpt block: start: blocks 0 next 1
find next checkpt block: search: block 1 oid 261 seq 4112 eccr 3
find next checkpt block: search: block 2 oid 261 seq 4112 eccr 3
find next checkpt block: search: block 3 oid 4 seq 0 eccr 3
find next checkpt block: search: block 4 oid 0 seq 0 eccr 0
find next checkpt block: search: block 5 oid 0 seq 0 eccr 0
<repeats until last block ...>
find next checkpt block: search: block 2046 oid 0 seq 0 eccr 0
find next checkpt block: search: block 2047 oid 0 seq 0 eccr 0
found no more checkpt blocks
checkpoint byte count 0
<should this be 0?>
restore exit: isCheckpointed 0
yaffs_ScanBackwards starts intstartblk 1 intendblk 2047...
<Yikes - do we expect this bad sequence?>
Block scanning block 3 has bad sequence number 0
<We do expect these 5 blocks to be bad, so that's OK>
block 127 is bad
block 840 is bad
block 1084 is bad
block 1706 is bad
block 1975 is bad
2 blocks to be sorted...
...done Allocating from 2 63
Allocating from 2 62
Allocating from 2 61
Allocating from 2 60
<snip>
Allocating from 1 5
Allocating from 1 4
Allocating from 1 3
Allocating from 1 2
yaffs_ScanBackwards endsyaffs: yaffs_GutsInitialise() done.
Then we read from our test file (which was already written on a previous
run of the program) and get the correct data.