aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/dcache.h
diff options
context:
space:
mode:
authorNick Piggin <npiggin@kernel.dk>2011-01-07 01:49:30 -0500
committerNick Piggin <npiggin@kernel.dk>2011-01-07 01:50:20 -0500
commit789680d1ee9311cdf095241dc02bd9784d799cd1 (patch)
treee6a984b0aa4791918f1b665f45210c2ab762969c /include/linux/dcache.h
parentec2447c278ee973d35f38e53ca16ba7f965ae33d (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.h35
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 {
184extern spinlock_t dcache_lock; 184extern spinlock_t dcache_lock;
185extern seqlock_t rename_lock; 185extern 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
203static 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
211static 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
220static inline int dname_external(struct dentry *dentry) 187static 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)
228extern void d_instantiate(struct dentry *, struct inode *); 195extern void d_instantiate(struct dentry *, struct inode *);
229extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); 196extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *);
230extern struct dentry * d_materialise_unique(struct dentry *, struct inode *); 197extern struct dentry * d_materialise_unique(struct dentry *, struct inode *);
198extern void __d_drop(struct dentry *dentry);
199extern void d_drop(struct dentry *dentry);
231extern void d_delete(struct dentry *); 200extern void d_delete(struct dentry *);
232 201
233/* allocate/de-allocate */ 202/* allocate/de-allocate */