From 290ccb59c3d84f771ce560591be8d6158b3fbcb9 Mon Sep 17 00:00:00 2001 From: Dipankar Sarma Date: Mon, 18 Oct 2004 18:14:13 -0700 Subject: [PATCH] Remove d_bucket Tested using dcachebench and hevy rename test. http://lse.sourceforge.net/locking/dcache/rename_test/ While going over dcache code, I realized that d_bucket which was introduced to prevent hash chain traversals from going into an infinite loop earlier, is no longer necessary. Originally, when RCU based lock-free lookup was first introduced, dcache hash chains used list_head. Hash chain traversal was terminated when dentry->next reaches the list_head in the hash bucket. However, if renames happen during a lock-free lookup, a dentry may move to different bucket and subsequent hash chain traversal from there onwards may not see the list_head in the original bucket at all. In fact, this would result in the list_head in the bucket interpreted as a list_head in dentry and bad things will happen after that. Once hlist based hash chains were introduced in dcache, the termination condition changed and lock-free traversal would be safe with NULL pointer based termination of hlists. This means that d_bucket check is no longer required. There still exist some theoritical livelocks like a dentry getting continuously moving and lock-free look-up never terminating. But that isn't really any worse that what we have. In return for these changes, we reduce the dentry size by the size of a pointer. That should make akpm and mpm happy. Signed-off-by: Dipankar Sarma Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/dcache.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include/linux') diff --git a/include/linux/dcache.h b/include/linux/dcache.h index b378e57b2743..f4bc1ac23daa 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -28,7 +28,7 @@ struct vfsmount; * "quick string" -- eases parameter passing, but more importantly * saves "metadata" about the string (ie length and the hash). * - * hash comes first so it snuggles against d_parent and d_bucket in the + * hash comes first so it snuggles against d_parent in the * dentry. */ struct qstr { @@ -91,7 +91,6 @@ struct dentry { * so they all fit in a 16-byte range, with 16-byte alignment. */ struct dentry *d_parent; /* parent directory */ - struct hlist_head *d_bucket; /* lookup hash bucket */ struct qstr d_name; struct list_head d_lru; /* LRU list */ -- cgit v1.2.3