aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 54f93f5e6b0f..028753951e95 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -67,20 +67,16 @@ struct dentry_stat_t dentry_stat = {
67 .age_limit = 45, 67 .age_limit = 45,
68}; 68};
69 69
70static void __d_free(struct dentry *dentry) 70static void __d_free(struct rcu_head *head)
71{ 71{
72 struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu);
73
72 WARN_ON(!list_empty(&dentry->d_alias)); 74 WARN_ON(!list_empty(&dentry->d_alias));
73 if (dname_external(dentry)) 75 if (dname_external(dentry))
74 kfree(dentry->d_name.name); 76 kfree(dentry->d_name.name);
75 kmem_cache_free(dentry_cache, dentry); 77 kmem_cache_free(dentry_cache, dentry);
76} 78}
77 79
78static void d_callback(struct rcu_head *head)
79{
80 struct dentry * dentry = container_of(head, struct dentry, d_u.d_rcu);
81 __d_free(dentry);
82}
83
84/* 80/*
85 * no dcache_lock, please. The caller must decrement dentry_stat.nr_dentry 81 * no dcache_lock, please. The caller must decrement dentry_stat.nr_dentry
86 * inside dcache_lock. 82 * inside dcache_lock.
@@ -91,9 +87,9 @@ static void d_free(struct dentry *dentry)
91 dentry->d_op->d_release(dentry); 87 dentry->d_op->d_release(dentry);
92 /* if dentry was never inserted into hash, immediate free is OK */ 88 /* if dentry was never inserted into hash, immediate free is OK */
93 if (hlist_unhashed(&dentry->d_hash)) 89 if (hlist_unhashed(&dentry->d_hash))
94 __d_free(dentry); 90 __d_free(&dentry->d_u.d_rcu);
95 else 91 else
96 call_rcu(&dentry->d_u.d_rcu, d_callback); 92 call_rcu(&dentry->d_u.d_rcu, __d_free);
97} 93}
98 94
99/* 95/*