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>
This commit is contained in:
@ -184,39 +184,6 @@ struct dentry_operations {
|
||||
extern spinlock_t dcache_lock;
|
||||
extern seqlock_t rename_lock;
|
||||
|
||||
/**
|
||||
* d_drop - drop a dentry
|
||||
* @dentry: dentry to drop
|
||||
*
|
||||
* d_drop() unhashes the entry from the parent dentry hashes, so that it won't
|
||||
* be found through a VFS lookup any more. Note that this is different from
|
||||
* deleting the dentry - d_delete will try to mark the dentry negative if
|
||||
* possible, giving a successful _negative_ lookup, while d_drop will
|
||||
* just make the cache lookup fail.
|
||||
*
|
||||
* d_drop() is used mainly for stuff that wants to invalidate a dentry for some
|
||||
* reason (NFS timeouts or autofs deletes).
|
||||
*
|
||||
* __d_drop requires dentry->d_lock.
|
||||
*/
|
||||
|
||||
static inline void __d_drop(struct dentry *dentry)
|
||||
{
|
||||
if (!(dentry->d_flags & DCACHE_UNHASHED)) {
|
||||
dentry->d_flags |= DCACHE_UNHASHED;
|
||||
hlist_del_rcu(&dentry->d_hash);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void d_drop(struct dentry *dentry)
|
||||
{
|
||||
spin_lock(&dcache_lock);
|
||||
spin_lock(&dentry->d_lock);
|
||||
__d_drop(dentry);
|
||||
spin_unlock(&dentry->d_lock);
|
||||
spin_unlock(&dcache_lock);
|
||||
}
|
||||
|
||||
static inline int dname_external(struct dentry *dentry)
|
||||
{
|
||||
return dentry->d_name.name != dentry->d_iname;
|
||||
@ -228,6 +195,8 @@ static inline int dname_external(struct dentry *dentry)
|
||||
extern void d_instantiate(struct dentry *, struct inode *);
|
||||
extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *);
|
||||
extern struct dentry * d_materialise_unique(struct dentry *, struct inode *);
|
||||
extern void __d_drop(struct dentry *dentry);
|
||||
extern void d_drop(struct dentry *dentry);
|
||||
extern void d_delete(struct dentry *);
|
||||
|
||||
/* allocate/de-allocate */
|
||||
|
Reference in New Issue
Block a user