[Yaffs] statfs call reports incorrect amount of free space

Mikhail Ryleev mryleev at gmail.com
Tue Dec 20 20:11:24 GMT 2005


Hi, all

It looks like statfs call reports incorrect amount of free space available
on device. It is off by the number of "deleted" but "uncollected" by garbage
collector files on device which can be signifficant in certain cases.
Such files belongs to "deleted" directory and while the amount of space
occupiend by data in such files is acounted as free, the entry in directory
is NOT.

The proposed fix does two things:

1:  nDeletedFiles variable would correctly count the number of "deleted" but
uncollected files
2:  the number of free blocks is adjusted by that value.


--- ./old/yaffs_guts.c 2005-12-19 20:02:18.000000000 -0800
+++ ./yaffs_guts.c 2005-12-20 11:54:58.000000000 -0800
@@ -2346,6 +2346,7 @@
        ("yaffs: About to finally delete object %d"
         TENDSTR), object->objectId));
     yaffs_DoGenericObjectDeletion(object);
+    object->myDev->nDeletedFiles--;
    }

   }
@@ -5690,6 +5691,8 @@
  nFree = yaffs_CountFreeChunks(dev);
 #endif

+    nFree += dev->nDeletedFiles;
+
  /* Now count the number of dirty chunks in the cache and subtract those */

  {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.aleph1.co.uk/pipermail/yaffs/attachments/20051220/81a1d91a/attachment.htm


More information about the yaffs mailing list