[DragonFlyBSD - Bug #2375] Wishlist: tmpfs directory lookup optimization

Johannes Hofmann via Redmine bugtracker-admin at leaf.dragonflybsd.org
Mon May 28 13:10:10 PDT 2012

Issue #2375 has been updated by Johannes Hofmann.

Both, the hash based version and my initial tree based one have an issue with renames onto an existing file (e.g.  touch a; touch b; mv b a; rm b).

A fixed tree based version is available at http://leaf.dragonflybsd.org/~hofmann/tmpfs_rbtree1.diff
This version also gets rid of the TAILQ and maintains directory entries only in the rb-tree. 

I did some performance tests on real hardware with a minimal C-program (http://leaf.dragonflybsd.org/~hofmann/file_create.c) with following results:

tmpfs as in master (4018c6eddd):
hofmann at blob:/mnt/bla >time file_create 50000

real    1m16.594s
user    0m0.617s
sys     1m14.681s

tmpfs as in master (ae879fe6cd + tmpfs5.diff + compile fixes):
hofmann at blob:/mnt/bla >time /home/hofmann/test/file_create 50000

real    0m5.706s
user    0m0.359s
sys     0m5.211s

tmpfs_rb no tailq (4018c6eddd + tmpfs_rbtree1.diff):
hofmann at blob:/mnt/bla >time /home/hofmann/test/file_create 50000

real    0m3.396s
user    0m0.195s
sys     0m3.203s

Bug #2375: Wishlist: tmpfs directory lookup optimization

Author: Venkatesh Srinivas
Status: New
Priority: Normal
Target version: 

tmpfs directories are structured as lists of directory entries; this leads to linear lookup costs. Directories with many files become fairly expensive to operate on.

http://leaf.dragonflybsd.org/~vsrinivas/tmpfs5.diff is a patch that introduces a 64-wide hash table (of lists) to speed up lookups. The patch is currently littered with debugging cruft and could benefit from cleaning.

http://leaf.dragonflybsd.org/~hofmann/tmpfs_rbtree.diff is a cleaner patch that uses an RB-tree, keyed on the name of the file in question.

Both approaches are solid improvements over the current lists, but could use some testing (benchmarking) to determine which is worth applying. The hash list patch has had many hours of fsstress testing; it now works well. The tree patches at the same points.

You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account

More information about the Bugs mailing list