*/
const char *yaffs_guts_c_version =
- "$Id: yaffs_guts.c,v 1.118 2010-03-12 01:22:48 charles Exp $";
+ "$Id: yaffs_guts.c,v 1.119 2010-03-12 02:48:34 charles Exp $";
#include "yportenv.h"
#include "yaffs_trace.h"
{
int i;
__u32 seq;
- yaffs_BlockInfo *b = 0;
+ yaffs_BlockInfo *b;
if(!dev->param.isYaffs2)
return 0;
/* Find the oldest dirty sequence number. */
seq = dev->sequenceNumber;
+ b = dev->blockInfo;
for (i = dev->internalStartBlock; i <= dev->internalEndBlock; i++) {
- b = yaffs_GetBlockInfo(dev, i);
if (b->blockState == YAFFS_BLOCK_STATE_FULL &&
(b->pagesInUse - b->softDeletions) < dev->param.nChunksPerBlock &&
b->sequenceNumber < seq)
seq = b->sequenceNumber;
+ b++;
}
return seq;
}
*/
dev->refreshSkip = dev->param.refreshPeriod;
dev->refreshCount++;
-
+ bi = dev->blockInfo;
for (b = dev->internalStartBlock; b <=dev->internalEndBlock; b++){
- bi = yaffs_GetBlockInfo(dev, b);
-
-
if (bi->blockState == YAFFS_BLOCK_STATE_FULL){
if(oldest < 1 ||
oldestSequence = bi->sequenceNumber;
}
}
+ bi++;
}
if (oldest > 0) {
/* First let's see if we need to grab a prioritised block */
if (dev->hasPendingPrioritisedGCs) {
+ bi = dev->blockInfo;
for (i = dev->internalStartBlock; i < dev->internalEndBlock && !prioritised; i++) {
- bi = yaffs_GetBlockInfo(dev, i);
- /* yaffs_VerifyBlock(dev,bi,i); */
-
if (bi->gcPrioritise) {
pendingPrioritisedExist = 1;
if (bi->blockState == YAFFS_BLOCK_STATE_FULL &&
aggressive = 1; /* Fool the non-aggressive skip logiv below */
}
}
+ bi++;
}
if (!pendingPrioritisedExist) /* None found, so we can clear this */
dev->sequenceNumber = YAFFS_LOWEST_SEQUENCE_NUMBER;
/* Scan all the blocks to determine their state */
+ bi = dev->blockInfo;
for (blk = dev->internalStartBlock; blk <= dev->internalEndBlock; blk++) {
- bi = yaffs_GetBlockInfo(dev, blk);
yaffs_ClearChunkBits(dev, blk);
bi->pagesInUse = 0;
bi->softDeletions = 0;
dev->nErasedBlocks++;
dev->nFreeChunks += dev->param.nChunksPerBlock;
}
+ bi++;
}
startIterator = dev->internalStartBlock;
chunkData = yaffs_GetTempBuffer(dev, __LINE__);
/* Scan all the blocks to determine their state */
+ bi = dev->blockInfo;
for (blk = dev->internalStartBlock; blk <= dev->internalEndBlock; blk++) {
- bi = yaffs_GetBlockInfo(dev, blk);
yaffs_ClearChunkBits(dev, blk);
bi->pagesInUse = 0;
bi->softDeletions = 0;
}
}
+ bi++;
}
T(YAFFS_TRACE_SCAN,
static int yaffs_CountFreeChunks(yaffs_Device *dev)
{
- int nFree;
+ int nFree=0;
int b;
yaffs_BlockInfo *blk;
- for (nFree = 0, b = dev->internalStartBlock; b <= dev->internalEndBlock;
- b++) {
- blk = yaffs_GetBlockInfo(dev, b);
-
+ blk = dev->blockInfo;
+ for (b = dev->internalStartBlock; b <= dev->internalEndBlock; b++) {
switch (blk->blockState) {
case YAFFS_BLOCK_STATE_EMPTY:
case YAFFS_BLOCK_STATE_ALLOCATING:
default:
break;
}
+ blk++;
}
return nFree;