OSDev.org
https://forum.osdev.org/

dentry cache questions
https://forum.osdev.org/viewtopic.php?f=15&t=36891
Page 1 of 1

Author:  ComputerFido [ Wed Jun 17, 2020 5:38 am ]
Post subject:  dentry cache questions

I have a few questions about the implementation of a dentry cache. I am a bit unsure on how to manage files with the same name in different directories on a filesystem as they would have the same hash value in the hash table. Should I check the parent directory against the path? Also, how should I manage subdirectories, should I have a linked list and only read the entries from the disk when the list is empty?

Author:  nullplan [ Wed Jun 17, 2020 7:46 am ]
Post subject:  Re: dentry cache questions

Depends on what you want to do. Either you make your dentry cache a map from inode and file name to inode, then every directory has its own entry cache and you don't need to deal with the same name twice. Or you make your dentry cache a map from path name to inode and device, then you also don't need to deal with the same name twice, though you do need to entirely resolve every path that goes into it first (add the CWD to relative paths, etc.). In either case, you do need a strategy to deal with hash collisions, since those are possible even with different names.

Author:  Korona [ Wed Jun 17, 2020 10:52 am ]
Post subject:  Re: dentry cache questions

Considering that hash collisions need to be handled anyway (at a lower level, namely in the hash table's implementation), using an inode number + file name seems to be the superior solution (less data to hash => faster lookup).

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/