Page 1 of 1

Problem with ext2 filesystem implementation

Posted: Sat Sep 03, 2011 10:34 am
by fiveayem
Hi,

I am trying to implementent the ext2 filesystem in my OS, and I have some difficulties with directory reading.

Let's recap all from the beginning. I decided to first implement reading operations, because in my opinion, this is the easiest part. So to test my readDirectoryByInode() function, I created a disk image, set up a ext2 fs on it, and mounted it. Then I had fun creating directories on my virtual disk. When I launched my OS in qemu, the root directory was read properly, every file was displayed.

But when I removed the directories just to make some other tests, I noticed that my ext2 driver still detected them as if they were on the disk. The reason is I use the file size attribute from the inode data structure to determine how many bytes I have to read. And this value did not change after I deleted the directories.

Consequently, I guess my method is not so good. How would you advise me to proceed ?

Thanks for reading me.

Re: Problem with ext2 filesystem implementation

Posted: Mon Sep 05, 2011 9:24 am
by jal
Have you read this?
the above mentioned page wrote:When a link is deleted, i.e. when one uses the rm command to remove a filename, the kernel decrements the links count and deallocates the inode if this count becomes zero.
JAL