*/
const char *yaffs_checkptrw_c_version =
- "$Id: yaffs_checkptrw.c,v 1.3 2006-05-21 09:39:12 charles Exp $";
+ "$Id: yaffs_checkptrw.c,v 1.4 2006-05-23 19:08:41 charles Exp $";
#include "yaffs_checkptrw.h"
yaffs_BlockInfo *bi = &dev->blockInfo[i];
if(bi->blockState == YAFFS_BLOCK_STATE_EMPTY){
dev->checkpointNextBlock = i + 1;
- dev->nErasedBlocks--;
dev->checkpointCurrentBlock = i;
T(YAFFS_TRACE_CHECKPOINT,(TSTR("allocating checkpt block %d"TENDSTR),i));
return;
return 0;
if(!dev->checkpointBuffer)
- dev->checkpointBuffer = YMALLOC(dev->nBytesPerChunk);
+ dev->checkpointBuffer = YMALLOC_DMA(dev->nBytesPerChunk);
if(!dev->checkpointBuffer)
return 0;
tags.chunkId = dev->checkpointPageSequence + 1;
tags.sequenceNumber = YAFFS_SEQUENCE_CHECKPOINT_DATA;
tags.byteCount = dev->nBytesPerChunk;
+ if(dev->checkpointCurrentChunk == 0){
+ /* First chunk we write for the block? Set block state to
+ checkpoint */
+ yaffs_BlockInfo *bi = &dev->blockInfo[dev->checkpointCurrentBlock];
+ bi->blockState = YAFFS_BLOCK_STATE_CHECKPOINT;
+ dev->blocksInCheckpoint++;
+ }
chunk = dev->checkpointCurrentBlock * dev->nChunksPerBlock + dev->checkpointCurrentChunk;