On Tuesday 20 September 2011 14:47:08 Xiaoguang Chen wrote: > Hi, Yaffs friends > I have one question about yaffs_handleChunkError function calling code > logic. In yaffs_ReadChunkWithTagsFromNAND: > > if (tags && > tags->eccResult > YAFFS_ECC_RESULT_NO_ERROR) { > > yaffs_BlockInfo *bi; > bi = yaffs_GetBlockInfo(dev, > chunkInNAND/dev->param.nChunksPerBlock); yaffs_HandleChunkError(dev, bi); > } > > Why use "tags->eccResult > YAFFS_ECC_RESULT_NO_ERROR " instead of > "tags->eccResult > YAFFS_ECC_RESULT_FIXED" ? > > If the flash has some one bit errors and these errors are corrected, > Tags->eccResult will be set to YAFFS_ECC_RESULT_FIXED. in this condition, > there should be no ecc problem. Why need to call yaffs_HandleChunkError ? We do this because we want to handle errors on the block before they start corrupting data. > > The problem is : if call yaffs_HandleChunkError, bi->chunkErrorStrikes++ > will be executed. After chunkErrorStrikes > 3, the block will be retired. > It will be marked as bad. But the block is not really bad. We can still use > it since it only has 4 times of fixed ECC error happened. If you have 1-bit correcting ECC then the above policy handles things well because single bit errors indicate that a block might have started going bad and we want to retire it before the block starts corrupting data. If you have multi-bit correcting data then it makes sense to modify what the driver reports. eg if you have 4 bit correcting then something like this makes sense: For 0,1 or 2 errors report NO ERROR. For 3 or 4 errors report FIXED. -- Charles