dcache.c (57b8628bb0ac4e47c806e45c5bbd89282e93869b) dcache.c (e419b4cc585680940bc42f8ca8a071d6023fb1bb)
1/*
2 * fs/dcache.c
3 *
4 * Complete reimplementation
5 * (C) 1997 Thomas Schoebel-Theuer,
6 * with heavy changes by Linus Torvalds
7 */
8

--- 127 unchanged lines hidden (view full) ---

136 return proc_dointvec(table, write, buffer, lenp, ppos);
137}
138#endif
139
140/*
141 * Compare 2 name strings, return 0 if they match, otherwise non-zero.
142 * The strings are both count bytes long, and count is non-zero.
143 */
1/*
2 * fs/dcache.c
3 *
4 * Complete reimplementation
5 * (C) 1997 Thomas Schoebel-Theuer,
6 * with heavy changes by Linus Torvalds
7 */
8

--- 127 unchanged lines hidden (view full) ---

136 return proc_dointvec(table, write, buffer, lenp, ppos);
137}
138#endif
139
140/*
141 * Compare 2 name strings, return 0 if they match, otherwise non-zero.
142 * The strings are both count bytes long, and count is non-zero.
143 */
144#ifdef CONFIG_DCACHE_WORD_ACCESS
145
146#include <asm/word-at-a-time.h>
147/*
148 * NOTE! 'cs' and 'scount' come from a dentry, so it has a
149 * aligned allocation for this particular component. We don't
150 * strictly need the load_unaligned_zeropad() safety, but it
151 * doesn't hurt either.
152 *
153 * In contrast, 'ct' and 'tcount' can be from a pathname, and do
154 * need the careful unaligned handling.
155 */
144static inline int dentry_cmp(const unsigned char *cs, size_t scount,
145 const unsigned char *ct, size_t tcount)
146{
156static inline int dentry_cmp(const unsigned char *cs, size_t scount,
157 const unsigned char *ct, size_t tcount)
158{
147#ifdef CONFIG_DCACHE_WORD_ACCESS
148 unsigned long a,b,mask;
149
150 if (unlikely(scount != tcount))
151 return 1;
152
153 for (;;) {
159 unsigned long a,b,mask;
160
161 if (unlikely(scount != tcount))
162 return 1;
163
164 for (;;) {
154 a = *(unsigned long *)cs;
155 b = *(unsigned long *)ct;
165 a = load_unaligned_zeropad(cs);
166 b = load_unaligned_zeropad(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));
167 if (tcount < sizeof(unsigned long))
168 break;
169 if (unlikely(a != b))
170 return 1;
171 cs += sizeof(unsigned long);
172 ct += sizeof(unsigned long);
173 tcount -= sizeof(unsigned long);
174 if (!tcount)
175 return 0;
176 }
177 mask = ~(~0ul << tcount*8);
178 return unlikely(!!((a ^ b) & mask));
179}
180
168#else
181#else
182
183static inline int dentry_cmp(const unsigned char *cs, size_t scount,
184 const unsigned char *ct, size_t tcount)
185{
169 if (scount != tcount)
170 return 1;
171
172 do {
173 if (*cs != *ct)
174 return 1;
175 cs++;
176 ct++;
177 tcount--;
178 } while (tcount);
179 return 0;
186 if (scount != tcount)
187 return 1;
188
189 do {
190 if (*cs != *ct)
191 return 1;
192 cs++;
193 ct++;
194 tcount--;
195 } while (tcount);
196 return 0;
180#endif
181}
182
197}
198
199#endif
200
183static void __d_free(struct rcu_head *head)
184{
185 struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu);
186
187 WARN_ON(!list_empty(&dentry->d_alias));
188 if (dname_external(dentry))
189 kfree(dentry->d_name.name);
190 kmem_cache_free(dentry_cache, dentry);

--- 2887 unchanged lines hidden ---
201static void __d_free(struct rcu_head *head)
202{
203 struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu);
204
205 WARN_ON(!list_empty(&dentry->d_alias));
206 if (dname_external(dentry))
207 kfree(dentry->d_name.name);
208 kmem_cache_free(dentry_cache, dentry);

--- 2887 unchanged lines hidden ---