diff options
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index a78e145a4357..e441941c834d 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -105,10 +105,10 @@ static unsigned int d_hash_shift __read_mostly; | |||
105 | static struct hlist_bl_head *dentry_hashtable __read_mostly; | 105 | static struct hlist_bl_head *dentry_hashtable __read_mostly; |
106 | 106 | ||
107 | static inline struct hlist_bl_head *d_hash(const struct dentry *parent, | 107 | static inline struct hlist_bl_head *d_hash(const struct dentry *parent, |
108 | unsigned long hash) | 108 | unsigned int hash) |
109 | { | 109 | { |
110 | hash += ((unsigned long) parent ^ GOLDEN_RATIO_PRIME) / L1_CACHE_BYTES; | 110 | hash += (unsigned long) parent / L1_CACHE_BYTES; |
111 | hash = hash ^ ((hash ^ GOLDEN_RATIO_PRIME) >> D_HASHBITS); | 111 | hash = hash + (hash >> D_HASHBITS); |
112 | return dentry_hashtable + (hash & D_HASHMASK); | 112 | return dentry_hashtable + (hash & D_HASHMASK); |
113 | } | 113 | } |
114 | 114 | ||
@@ -144,6 +144,28 @@ int proc_nr_dentry(ctl_table *table, int write, void __user *buffer, | |||
144 | static inline int dentry_cmp(const unsigned char *cs, size_t scount, | 144 | static inline int dentry_cmp(const unsigned char *cs, size_t scount, |
145 | const unsigned char *ct, size_t tcount) | 145 | const unsigned char *ct, size_t tcount) |
146 | { | 146 | { |
147 | #ifdef CONFIG_DCACHE_WORD_ACCESS | ||
148 | unsigned long a,b,mask; | ||
149 | |||
150 | if (unlikely(scount != tcount)) | ||
151 | return 1; | ||
152 | |||
153 | for (;;) { | ||
154 | a = *(unsigned long *)cs; | ||
155 | b = *(unsigned long *)ct; | ||
156 | if (tcount < sizeof(unsigned long)) | ||
157 | break; | ||
158 | if (unlikely(a != b)) | ||
159 | return 1; | ||
160 | cs += sizeof(unsigned long); | ||
161 | ct += sizeof(unsigned long); | ||
162 | tcount -= sizeof(unsigned long); | ||
163 | if (!tcount) | ||
164 | return 0; | ||
165 | } | ||
166 | mask = ~(~0ul << tcount*8); | ||
167 | return unlikely(!!((a ^ b) & mask)); | ||
168 | #else | ||
147 | if (scount != tcount) | 169 | if (scount != tcount) |
148 | return 1; | 170 | return 1; |
149 | 171 | ||
@@ -155,6 +177,7 @@ static inline int dentry_cmp(const unsigned char *cs, size_t scount, | |||
155 | tcount--; | 177 | tcount--; |
156 | } while (tcount); | 178 | } while (tcount); |
157 | return 0; | 179 | return 0; |
180 | #endif | ||
158 | } | 181 | } |
159 | 182 | ||
160 | static void __d_free(struct rcu_head *head) | 183 | static void __d_free(struct rcu_head *head) |