*/
//yaffs_guts.c
-const char *yaffs_guts_c_version="$Id: yaffs_guts.c,v 1.29 2003-08-29 17:53:05 aleph1 Exp $";
+const char *yaffs_guts_c_version="$Id: yaffs_guts.c,v 1.30 2003-09-16 06:48:38 charles Exp $";
#include "yportenv.h"
{
if(tn->level0[i])
{
+ // Note this does not find the real chunk, only the chunk group.
+ // We make an assumption that a chunk group is niot larger than a block.
theChunk = (tn->level0[i] << in->myDev->chunkGroupBits);
T(YAFFS_TRACE_SCAN,(TSTR("soft delete tch %d cgb %d chunk %d" TENDSTR),
tn->level0[i],in->myDev->chunkGroupBits,theChunk));
{
yaffs_SpareInitialise(&spare);
+#ifdef CONFIG_MTD_NAND_VERIFY_WRITE
+
//read data before write, to ensure correct ecc
- //and transitions are guaranteed 1->0
+ //if we're using MTD verification under Linux
yaffs_ReadChunkFromNAND(dev,chunkId,NULL,&spare,0);
-
+#endif
+
spare.pageStatus = 0; // To mark it as deleted.
int extraBits;
int nBlocks;
- if( dev->nBytesPerChunk != YAFFS_BYTES_PER_CHUNK ||
-
+ if( dev->nBytesPerChunk != YAFFS_BYTES_PER_CHUNK ||
dev->nChunksPerBlock < 2 ||
dev->nReservedBlocks < 2 ||
dev->startBlock <= 0 ||
{
dev->chunkGroupBits = bits - 16;
}
+
dev->chunkGroupSize = 1 << dev->chunkGroupBits;
+
+ if(dev->nChunksPerBlock < dev->chunkGroupSize)
+ {
+ // We have a problem because the soft delete won't work if
+ // the chunk group size > chunks per block.
+ // This can be remedied by using larger "virtual blocks".
+
+ return YAFFS_FAIL;
+ }
+