use rb-tree for directory lookups
authorJohannes Hofmann <johannes.hofmann@gmx.de>
Tue, 22 May 2012 21:37:55 +0000 (23:37 +0200)
committerFrançois Tigeot <ftigeot@wolfpond.org>
Mon, 18 Jun 2012 07:15:28 +0000 (09:15 +0200)
commit29ca4fd6da8bb70ae90d8e73ea3c47fda22491a7
treeca26f352aa83cd718edf9c4ce55c0a8b4eb1242f
parent1c482147161e84edc1dbe4f1b41114b9ad16c552
use rb-tree for directory lookups

* 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.

* This patch uses a rb-tree keyed on the name of the searched file to
  speed up lookups

* Besides this rb-tree implementation, a hash version was also tested.
  Both gave solid performance enhancements compared to the previous tmpfs
  implementation.
  The rb-tree version was the faster of the two and thus becomes the
  choosen one.

* See issue 2375 for details and performance numbers
  https://bugs.dragonflybsd.org/issues/2375
sys/vfs/tmpfs/tmpfs.h
sys/vfs/tmpfs/tmpfs_subr.c
sys/vfs/tmpfs/tmpfs_vfsops.c
sys/vfs/tmpfs/tmpfs_vnops.c