Hi Charles, 2009/12/21 Charles Manning : >> Would that be the root directory? > Yes that is one chunk which has been used by the root directory. > >> I wonder if: >> >> mount -t yaffs2 /dev/mtdblock0 /mnt >> df >> ls -ld /mnt >> cp * /mnt >> df >> ls -ld /mnt >> rm /mnt/* >> df >> ls -ld /mnt >> >> would show that the root directory uses the 4 blocks to hold the >> directory entries for the files copied in. > > Not quite > > A directory object does not hold its contents. Instead each object's details > are stored in an object header. > However, writing a file in a directory causes the object header for the > directory to be updated too (since the directories mtime and ctime must be > updated). If there was no previous object header for root then one will be > written. >> >> Is there code to garbage collect directories when the entries are >> deleted? > > This is not needed. > > For a better understanding, read > http://users.actrix.co.nz/manningc/yaffs/HowYaffsWorks.pdf > > This is certainly not a "leak". The only "lost" chunk is that root directory > and that is expected. > Thanks for clarification. I have another test follow: 1.mount an yaffs partition on which chunks for root directory are already occupied. 2.df 3.call fsx-linux test program from ltp for some while 4.remove the test file 5.df we'll find that the there're some "leak" blocks. However, if we copy sth. to the mount dir and then remove them for many times, we'll find that the "leak" blocks are back. Is is because file hole have an impact on gc? Thanks, Jisheng