diff options
author | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 01:49:30 -0500 |
---|---|---|
committer | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 01:50:20 -0500 |
commit | 789680d1ee9311cdf095241dc02bd9784d799cd1 (patch) | |
tree | e6a984b0aa4791918f1b665f45210c2ab762969c /include/linux/dcache.h | |
parent | ec2447c278ee973d35f38e53ca16ba7f965ae33d (diff) |
fs: dcache scale hash
Add a new lock, dcache_hash_lock, to protect the dcache hash table from
concurrent modification. d_hash is also protected by d_lock.
Signed-off-by: Nick Piggin <npiggin@kernel.dk>
Diffstat (limited to 'include/linux/dcache.h')
-rw-r--r-- | include/linux/dcache.h | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index cea27dfca532..2feb624b67f1 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -184,39 +184,6 @@ struct dentry_operations { | |||
184 | extern spinlock_t dcache_lock; | 184 | extern spinlock_t dcache_lock; |
185 | extern seqlock_t rename_lock; | 185 | extern seqlock_t rename_lock; |
186 | 186 | ||
187 | /** | ||
188 | * d_drop - drop a dentry | ||
189 | * @dentry: dentry to drop | ||
190 | * | ||
191 | * d_drop() unhashes the entry from the parent dentry hashes, so that it won't | ||
192 | * be found through a VFS lookup any more. Note that this is different from | ||
193 | * deleting the dentry - d_delete will try to mark the dentry negative if | ||
194 | * possible, giving a successful _negative_ lookup, while d_drop will | ||
195 | * just make the cache lookup fail. | ||
196 | * | ||
197 | * d_drop() is used mainly for stuff that wants to invalidate a dentry for some | ||
198 | * reason (NFS timeouts or autofs deletes). | ||
199 | * | ||
200 | * __d_drop requires dentry->d_lock. | ||
201 | */ | ||
202 | |||
203 | static inline void __d_drop(struct dentry *dentry) | ||
204 | { | ||
205 | if (!(dentry->d_flags & DCACHE_UNHASHED)) { | ||
206 | dentry->d_flags |= DCACHE_UNHASHED; | ||
207 | hlist_del_rcu(&dentry->d_hash); | ||
208 | } | ||
209 | } | ||
210 | |||
211 | static inline void d_drop(struct dentry *dentry) | ||
212 | { | ||
213 | spin_lock(&dcache_lock); | ||
214 | spin_lock(&dentry->d_lock); | ||
215 | __d_drop(dentry); | ||
216 | spin_unlock(&dentry->d_lock); | ||
217 | spin_unlock(&dcache_lock); | ||
218 | } | ||
219 | |||
220 | static inline int dname_external(struct dentry *dentry) | 187 | static inline int dname_external(struct dentry *dentry) |
221 | { | 188 | { |
222 | return dentry->d_name.name != dentry->d_iname; | 189 | return dentry->d_name.name != dentry->d_iname; |
@@ -228,6 +195,8 @@ static inline int dname_external(struct dentry *dentry) | |||
228 | extern void d_instantiate(struct dentry *, struct inode *); | 195 | extern void d_instantiate(struct dentry *, struct inode *); |
229 | extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); | 196 | extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); |
230 | extern struct dentry * d_materialise_unique(struct dentry *, struct inode *); | 197 | extern struct dentry * d_materialise_unique(struct dentry *, struct inode *); |
198 | extern void __d_drop(struct dentry *dentry); | ||
199 | extern void d_drop(struct dentry *dentry); | ||
231 | extern void d_delete(struct dentry *); | 200 | extern void d_delete(struct dentry *); |
232 | 201 | ||
233 | /* allocate/de-allocate */ | 202 | /* allocate/de-allocate */ |