Hi,
In yaffs_WriteNewChunkWithTagsToNAND, write retry will happen when
yaffs_CheckChunkErased fails.
If the first chunk of an erased block fails this check, later chunks
of this block will still
get allocated and written. But the first chunk still remains an unused
status. So during next
mount, yaffs_ScanBackwards will ignore these written blocks.
I suggest a patch like:
if (!bi->skipErasedCheck) {
erasedOk = yaffs_CheckChunkErased(dev, chunk);
if (erasedOk != YAFFS_OK) {
T(YAFFS_TRACE_ERROR,
(TSTR ("**>> yaffs chunk %d was not erased"
TENDSTR), chunk));
+
+ if(chunk%dev->nChunksPerBlock == 0){
+ yaffs_HandleChunkError( dev, i);
+ dev->allocationBlock = -1;
+ }
/* try another chunk */
continue;
}
bi->skipErasedCheck = 1;
}
--
Regards, neversetsun