
Le 15/06/2010 12:42, Ivan Nardi a écrit :
Hello!
I'am having a look at the ecc algorithms in nand code and I observe (both in kernel and in u-boot) that when ecc corrects some data, corrected data are given to the user, but the data storage in the nand do not change. In other words, I expected the flash would be written with the new (corrected) data.
Why data corrected by ecc are not rewrite to the flash?
I think that it should be easy achieve this goal. In the read function, if ecc corrects some data on a page, I read the entire block, erase it and write back (correct) data to the flash.
Nobody is interested in this feature? Or is it more difficult than I think?
Thanks a lot!
Let me play the devil's advocate here: what would be the interest of writing back corrected data to the flash? Here's my take at the pros and cons of writing ECC-corrected data back to flash:
Cons:
- risk of the write failing more or less critically;
- performance hit (albeit marginal hopefully);
- risk of spurious data corruption: if the ECC detection/correction or write decision code is buggy, you may end up with a write-back where unnecessary, and possibly write the wrong data back to flash. The current situation, at least, guarantees that the Flash content is preserved even if ECC detection/correction gets it wrong.
Pros:
- marginal performance gain for subsequent reads of ECC, assuming the data is read frequently enough that the correction time becomes significant wrt all the rest of the bootloader execution.
But the bottom line is: there is no benefit as far as the data itself is concerned since it is correct without writing it back to Flash.
Amicalement,