Problem with ext2 filesystem implementation

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
fiveayem
Member
Member
Posts: 51
Joined: Sun Aug 14, 2011 8:01 am

Problem with ext2 filesystem implementation

Post 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.
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: Problem with ext2 filesystem implementation

Post 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
Post Reply