Yaffs does not have any specific code to handle read disturb, but the background gc (with Linux) will occasionally copy the oldest block, thus doing a "refresh" which goes some way towards addressing read disturb.
Doing page remapping behind the scenes like this would require some code that does something along the lines of what the garbage collection does:
- Look at the tags on each page.
- Find where that fits in
- Fix up the trees etc.
If you are rewriting the entire block and doing something like this then you should not be changing the sequence number, for the reason I'll try to explain below:
The sequence number is used to determine where the block fits in the time line. If you just take an old block, copy it, and give it a new sequence number then you will "change history". This will mess many things up. For just one example (there are many), consider this:
In seq 5000:
- Create a file called "foo". Length is now 0.
- Write some data to the file.
In seq 5001:
- Write more data tp the file.
- Close the file, update the file header to show size = 5mbytes.
Now copy block seq 5000, renumbering it to seq 5002.
- Now block seq 5002 shows file "foo" has size 0.
If the partition is remounted and scanned, we will see the file size is 0, so all the file data will be ignored. History has been violated.
Now garbage collection does do copying, from an old seq number to a new seq number, but it does so very carefully so that history is preserved.
Another alternative might be to trigger gc on a block once read disturb limits are being approached. This can be done by setting the block's gc_prioritise bit. See yaffs_handle_chunk_error() for an example. This will then cause the block to be garbage collected as soon as possible (ie without violating history). This will not, however, use the fancy NAND copy code.
Regards
Charles