-
/*
* YAFFS: Yet another FFS. A NAND-flash specific file system.
*
*/
//yaffs_guts.c
-const char *yaffs_guts_c_version="$Id: yaffs_guts.c,v 1.9 2005-07-18 23:16:04 charles Exp $";
+const char *yaffs_guts_c_version="$Id: yaffs_guts.c,v 1.11 2005-07-27 02:00:48 charles Exp $";
#include "yportenv.h"
{
newTnodes[i].internal[0] = &newTnodes[i+1];
#ifdef CONFIG_YAFFS_TNODE_LIST_DEBUG
- newTnodes[i].internal[YAFFS_NTNODES_INTERNAL] = 1;
+ newTnodes[i].internal[YAFFS_NTNODES_INTERNAL] = (void *)1;
#endif
}
newTnodes[nTnodes - 1].internal[0] = dev->freeTnodes;
#ifdef CONFIG_YAFFS_TNODE_LIST_DEBUG
- newTnodes[nTnodes - 1].internal[YAFFS_NTNODES_INTERNAL] = 1;
+ newTnodes[nTnodes - 1].internal[YAFFS_NTNODES_INTERNAL] = (void *)1;
#endif
dev->freeTnodes = newTnodes;
dev->nFreeTnodes+= nTnodes;
{
tn = dev->freeTnodes;
#ifdef CONFIG_YAFFS_TNODE_LIST_DEBUG
- if(tn->internal[YAFFS_NTNODES_INTERNAL] != 1)
+ if(tn->internal[YAFFS_NTNODES_INTERNAL] != (void *)1)
{
// Hoosterman, this thing looks like it isn't in the list
T(YAFFS_TRACE_ALWAYS,(TSTR("yaffs: Tnode list bug 1" TENDSTR)));
// Hoosterman, this thing looks like it is already in the list
T(YAFFS_TRACE_ALWAYS,(TSTR("yaffs: Tnode list bug 2" TENDSTR)));
}
- tn->internal[YAFFS_NTNODES_INTERNAL] = 1;
+ tn->internal[YAFFS_NTNODES_INTERNAL] = (void *)1;
#endif
tn->internal[0] = dev->freeTnodes;
dev->freeTnodes = tn;
dev->nFreeChunks -= bi->softDeletions; // Take off the number of soft deleted entries because
// they're going to get really deleted during GC.
+ dev->isDoingGC = 1;
if(!yaffs_StillSomeChunkBits(dev,block))
{
}
+ dev->isDoingGC = 0;
+
//yaffs_VerifyFreeChunks(dev);
return YAFFS_OK;
int gcOk = YAFFS_OK;
int maxTries = 0;
- //yaffs_DoUnlinkedFileDeletion(dev);
-
//yaffs_VerifyFreeChunks(dev);
+
+ if(dev->isDoingGC)
+ {
+ // Bail out so we don't get recursive gc
+ return YAFFS_OK;
+ }
// This loop should pass the first time.
// We'll only see looping here if the erase of the collected block fails.
static void yaffs_FlushFilesChunkCache(yaffs_Object *obj)
{
yaffs_Device *dev = obj->myDev;
- int lowest;
+ int lowest = -99; // Stop compiler whining.
int i;
yaffs_ChunkCache *cache;
int chunkWritten = 0;
dev->sequenceNumber = YAFFS_LOWEST_SEQUENCE_NUMBER;
- if(dev->isYaffs2)
- {
- blockIndex = YMALLOC(nBlocks * sizeof(yaffs_BlockIndex));
- }
+ blockIndex = YMALLOC(nBlocks * sizeof(yaffs_BlockIndex));
// Scan all the blocks to determine their state
// Sort the blocks
// Dungy old bubble sort for now...
- if(dev->isYaffs2)
{
yaffs_BlockIndex temp;
int i;
// Now scan the blocks looking at the data.
- if(dev->isYaffs2)
- {
- startIterator = 0;
- endIterator = nBlocksToScan-1;
- T(YAFFS_TRACE_SCAN_DEBUG,(TSTR("%d blocks to be scanned" TENDSTR),nBlocksToScan));
- }
+ startIterator = 0;
+ endIterator = nBlocksToScan-1;
+ T(YAFFS_TRACE_SCAN_DEBUG,(TSTR("%d blocks to be scanned" TENDSTR),nBlocksToScan));
// For each block.... backwards
dev->tagsEccUnfixed=0;
dev->nErasureFailures = 0;
dev->nErasedBlocks = 0;
+ dev->isDoingGC = 0;
//dev->localBuffer = YMALLOC(dev->nBytesPerChunk);
// Initialise temporary buffers