* [PATCH 1/2] vfs: simpler d_hash()
@ 2016-11-22 19:57 Alexey Dobriyan
0 siblings, 0 replies; only message in thread
From: Alexey Dobriyan @ 2016-11-22 19:57 UTC (permalink / raw)
To: viro; +Cc: linux-fsdevel
Precalculate "32 - d_cache_shift".
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
fs/dcache.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -106,7 +106,7 @@ static struct hlist_bl_head *dentry_hashtable __read_mostly;
static inline struct hlist_bl_head *d_hash(unsigned int hash)
{
- return dentry_hashtable + (hash >> (32 - d_hash_shift));
+ return dentry_hashtable + (hash >> d_hash_shift);
}
#define IN_LOOKUP_SHIFT 10
@@ -3560,6 +3560,8 @@ static void __init dcache_init_early(void)
for (loop = 0; loop < (1U << d_hash_shift); loop++)
INIT_HLIST_BL_HEAD(dentry_hashtable + loop);
+
+ d_hash_shift = 32 - d_hash_shift;
}
static void __init dcache_init(void)
@@ -3591,6 +3593,8 @@ static void __init dcache_init(void)
for (loop = 0; loop < (1U << d_hash_shift); loop++)
INIT_HLIST_BL_HEAD(dentry_hashtable + loop);
+
+ d_hash_shift = 32 - d_hash_shift;
}
/* SLAB cache for __getname() consumers */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-11-22 17:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-22 19:57 [PATCH 1/2] vfs: simpler d_hash() Alexey Dobriyan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).