Skip to content

D Cache

gerard edited this page Sep 14, 2010 · 3 revisions

The directory cache should map paths (strings) to inode numbers. This should work together with the I-Cache, as they are closely related.

Implementation details:

  • Current implementation consists of a tree that maps the directory structure (and, as such, each node has a unlimited amount of childs).
  • Struct size is calculated to be cache-friendly and it doesn’t actually store any entry with a path longer than it can fit to the structure (how much is that depends on the pointer size on the architecture)
  • There is no way to free these entries. The mechanism to free these entries when they no longer are considered to be useful is still to be considered. There are some options:
    • Having a background task
    • Freeing entries as the tree is traversed in lookup
  • Current insert/lookup operations don’t require lock (if we assume pointer assignment to be atomic) but insert can actually race with himself when adding a new node. This may end up provoking duplicated entries, but should do no other harm than taking some more memory.

FUSE specific considerations:

  • All paths provided by FUSE are absolute and contain no symbolic link indirection.
  • FUSE runs multi-threaded. There is a way to change that, but we don’t like that.

Relevant Commits:

Clone this wiki locally