Hi guys:

 
Currently, if an error happens when yaffs2_CheckpointErase() erases a block, 
The wrong address is used to mark the bad block, I think that it is a bug ,
Fix this by subtracting the proper block offset from the address. the code is as follows:


--- a/fs/yaffs2/yaffs_checkptrw.c
+++ b/fs/yaffs2/yaffs_checkptrw.c
@@ -47,7 +47,7 @@ static int yaffs2_CheckpointErase(yaffs_Device *dev)
                                if (dev->param.eraseBlockInNAND(dev, i - dev->blockOffset /* realign */)) {
                                dev->nErasedBlocks++;
                                dev->nFreeChunks += dev->param.nChunksPerBlock;
                        } else {
-                               dev->param.markNANDBlockBad(dev, i);
+                               dev->param.markNANDBlockBad(dev, i - dev->blockOffset);
                                bi->blockState = YAFFS_BLOCK_STATE_DEAD;
                        }
                }
 

Thanks
senk




网易公开课推出哈佛最受欢迎《幸福》课程,帮您修满幸福学分!