summaryrefslogtreecommitdiff
path: root/libdiskfs/fhandle.h
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-05-29 02:03:03 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2014-05-29 18:39:43 +0200
commit2c7ecdc6ec8f9d9a27aa7e4e82fa2d84fa55fe9b (patch)
tree71901e3d26df808b03b5e5baa214a0ffa22fe6be /libdiskfs/fhandle.h
parentd0c565fc35e8dc3daa5fb6e9a514c34873e6b204 (diff)
libdiskfs: use a hash table for the name cache
Previously, name cache lookup operation completed in O(n) time. This means that making the cache too large would decrease the performance. Therefore it was required to tune the size. Implement the name cache using a hash table. We use buckets of a fixed size. We approximate the least-frequently used cache algorithm by counting the number of lookups using saturating arithmetic in the two lowest bits of the pointer to the name. Using this strategy we achieve a constant worst-case lookup and insertion time. Since we are not bound by the size of the cache anymore, increase its size from 200 to 1024. * libdiskfs/name-cache.c: Implement the name cache using a hash table. (diskfs_enter_lookup_cache): Change accordingly. (diskfs_purge_lookup_cache): Likewise. (diskfs_check_lookup_cache): Likewise. Also, hard code a cache miss for the parent of the root directory and merge unlocking and releasing of node references.
Diffstat (limited to 'libdiskfs/fhandle.h')
0 files changed, 0 insertions, 0 deletions