projects
/
yaffs2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix free space reporting as per Mikhail Rileev's patch
[yaffs2.git]
/
yaffs_guts.c
diff --git
a/yaffs_guts.c
b/yaffs_guts.c
index c5be37ff748c02f431dde13b2ad10f7186737cfd..e949e319aa2fb1a5b60dad1ae117839c8b10fa93 100644
(file)
--- a/
yaffs_guts.c
+++ b/
yaffs_guts.c
@@
-13,7
+13,7
@@
*/
const char *yaffs_guts_c_version =
*/
const char *yaffs_guts_c_version =
- "$Id: yaffs_guts.c,v 1.2
6 2005-12-19 21:46:07
charles Exp $";
+ "$Id: yaffs_guts.c,v 1.2
9 2006-02-08 22:29:14
charles Exp $";
#include "yportenv.h"
#include "yportenv.h"
@@
-335,6
+335,7
@@
static Y_INLINE int yaffs_StillSomeChunkBits(yaffs_Device * dev, int blk)
static Y_INLINE int yaffs_HashFunction(int n)
{
static Y_INLINE int yaffs_HashFunction(int n)
{
+ n = abs(n);
return (n % YAFFS_NOBJECT_BUCKETS);
}
return (n % YAFFS_NOBJECT_BUCKETS);
}
@@
-2346,6
+2347,7
@@
static int yaffs_GarbageCollectBlock(yaffs_Device * dev, int block)
("yaffs: About to finally delete object %d"
TENDSTR), object->objectId));
yaffs_DoGenericObjectDeletion(object);
("yaffs: About to finally delete object %d"
TENDSTR), object->objectId));
yaffs_DoGenericObjectDeletion(object);
+ object->myDev->nDeletedFiles--;
}
}
}
}
@@
-4437,7
+4439,7
@@
static int yaffs_ScanBackwards(yaffs_Device * dev)
yaffs_Object *in;
yaffs_Object *parent;
int nBlocks = dev->internalEndBlock - dev->internalStartBlock + 1;
yaffs_Object *in;
yaffs_Object *parent;
int nBlocks = dev->internalEndBlock - dev->internalStartBlock + 1;
-
+ int itsUnlinked;
__u8 *chunkData;
yaffs_BlockIndex *blockIndex = NULL;
__u8 *chunkData;
yaffs_BlockIndex *blockIndex = NULL;
@@
-4847,11
+4849,8
@@
static int yaffs_ScanBackwards(yaffs_Device * dev)
yaffs_AddObjectToDirectory(parent, in);
yaffs_AddObjectToDirectory(parent, in);
- if ((parent == dev->deletedDir ||
- parent == dev->unlinkedDir)) {
- /* If it is unlinked at start up then it wants deleting */
- in->deleted = 1;
- }
+ itsUnlinked = (parent == dev->deletedDir) ||
+ (parent == dev->unlinkedDir);
if (oh->isShrink) {
/* Mark the block as having a shrinkHeader */
if (oh->isShrink) {
/* Mark the block as having a shrinkHeader */
@@
-4894,7
+4893,7
@@
static int yaffs_ScanBackwards(yaffs_Device * dev)
break;
case YAFFS_OBJECT_TYPE_HARDLINK:
break;
case YAFFS_OBJECT_TYPE_HARDLINK:
- if(!i
n->delet
ed) {
+ if(!i
tsUnlink
ed) {
in->variant.hardLinkVariant.equivalentObjectId =
oh->equivalentObjectId;
in->hardLinks.next =
in->variant.hardLinkVariant.equivalentObjectId =
oh->equivalentObjectId;
in->hardLinks.next =
@@
-5693,6
+5692,8
@@
int yaffs_GetNumberOfFreeChunks(yaffs_Device * dev)
nFree = yaffs_CountFreeChunks(dev);
#endif
nFree = yaffs_CountFreeChunks(dev);
#endif
+ nFree += dev->nDeletedFiles;
+
/* Now count the number of dirty chunks in the cache and subtract those */
{
/* Now count the number of dirty chunks in the cache and subtract those */
{