Sergei I know I have been silent on this a while, but that is mainly because I have been thinking... For now I will put aside the rename problem which has a fix that I need to complete and will instead focus on the actual power fial issues. > As I reported sometimes power cycling produces files where some/few zeros > are flipped to ones. I have the following hypothesis, please let me know if > it makes sense or I am missing something in my understanding of yaffs_guts. > > 1. The error does not happen under stable power condition so it is likely > that power fail causes partial programming, e.g. some ones do not program > to zero. 2. Initial scan will not check crc on data and happily count a > page as a valid chunk of the file. YAFFS currently assumes that a power failure will not destroy a write. For the most par that should be an OK assumption since once a flash programming cycle has been set up it should execute in 200uS. THere should be enough residual power in the system to complete that. Two things that can be done to improve the situation at the low level: 1) Ensure that the whole page write is being done as a single write at the mtd level (ie. writing the data and oob as seperate operations is not good). 2) Add a power check step just before the write in the mtd (assuming you have a power fail warning flag) ie nand_write(..) { set up write while(!power_good){spin} complete write } There is also something that can be done in YAFFS: Better handling of power fail by checking the condition of the last write beforepower failed. If it was bad we can just discard it. > 3. Garbage collector may later copy the bad page without checking crc (!) > to a new block and assign it a (new) good crc. There is no crc, but there is ecc. YAFFS should be applying ECC during gc too as it is part of the standard read. THis will fix single bit errors, but not partially written pages. -- Charles