*/
//yaffs_guts.c
-const char *yaffs_guts_c_version="$Id: yaffs_guts.c,v 1.36 2004-10-10 17:54:59 charles Exp $";
+const char *yaffs_guts_c_version="$Id: yaffs_guts.c,v 1.40 2005-04-05 03:45:40 charles Exp $";
#include "yportenv.h"
yaffs_Device *dev = tn->myDev;
+#ifdef __KERNEL__
+ if(tn->myInode)
+ {
+ // We're still hooked up to a cached inode.
+ // Don't delete now, but mark for later deletion
+ tn->deferedFree = 1;
+ return;
+ }
+#endif
+
yaffs_UnhashObject(tn);
// Link into the free list.
}
+#ifdef __KERNEL__
+
+void yaffs_HandleDeferedFree(yaffs_Object *obj)
+{
+ if(obj->deferedFree)
+ {
+ yaffs_FreeObject(obj);
+ }
+}
+
+#endif
+
static void yaffs_DeinitialiseObjects(yaffs_Device *dev)
in = list_entry(i, yaffs_Object,hashLink);
if(in->objectId == number)
{
+#ifdef __KERNEL__
+ // Don't tell the VFS about this if it has been marked for freeing
+ if(in->deferedFree)
+ return NULL;
+#endif
return in;
}
}
int lowest;
int i;
yaffs_ChunkCache *cache;
- int chunkWritten;
+ int chunkWritten = 0;
int nBytes;
int nCaches = obj->myDev->nShortOpCaches;
yaffs_RemoveObjectFromDirectory(in);
yaffs_DeleteChunk(in->myDev,in->chunkId,1);
+ in->chunkId = -1;
+#if 0
#ifdef __KERNEL__
if(in->myInode)
{
in->myInode->u.generic_ip = NULL;
- in->myInode = 0;
+ in->myInode = NULL;
}
+#endif
#endif
yaffs_FreeObject(in);
return YAFFS_OK;
#ifdef __KERNEL__
if(!in->myInode)
{
+ // Might be open at present,
+ // Caught by delete_inode in yaffs_fs.c
immediateDeletion = 1;
}
dev->eccUnfixed=0;
dev->tagsEccFixed=0;
dev->tagsEccUnfixed=0;
+ dev->nErasedBlocks=0;
dev->localBuffer = YMALLOC(dev->nBytesPerChunk);
if(dev->nShortOpCaches > 0)
YFREE(dev->srCache);
YFREE(dev->localBuffer);
+ dev->isMounted = 0;
}
}