Dear Charles,
i use YDI in my application, and i want to determine whether the Yaffs2 is
strong enough in power failure.
my test code show below:
yflash2_WriteChunkWithTagsToNAND()
{
...
if (data) {
int write_size;
if (!(rand() % 1000)) {
write_size = rand() % PAGE_SIZE;
} else {
write_size = PAGE_SIZE;
}
write(h, localBuffer, write_size); //write data to fileem2k
if (write_size < PAGE_SIZE) {
exit(0); //power failure
}
}
...
}
when power failure, program only write part of data to flash and exit.then
running again, you can found yaffs catch a ECC error in function
yaffs_ReadChunkFromNAND(), and the block contain this chunk will be
retired. try more and more times, the free space of yaffs will come less
and less. but in my appear, this ecc error not means the block is really
bad.
can you help me how to fix this bug, or how to do GC at this
condition.Thanks very much.
Best Regards,