提交 b4f0354e 编写于 作者: A Al Viro

new helper: dentry_free()

The part of old d_free() that dealt with actual freeing of dentry.
Taken out of dentry_kill() into a separate function.
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 5c47e6d0
...@@ -246,6 +246,15 @@ static void __d_free(struct rcu_head *head) ...@@ -246,6 +246,15 @@ static void __d_free(struct rcu_head *head)
kmem_cache_free(dentry_cache, dentry); kmem_cache_free(dentry_cache, dentry);
} }
static void dentry_free(struct dentry *dentry)
{
/* if dentry was never visible to RCU, immediate free is OK */
if (!(dentry->d_flags & DCACHE_RCUACCESS))
__d_free(&dentry->d_u.d_rcu);
else
call_rcu(&dentry->d_u.d_rcu, __d_free);
}
/** /**
* dentry_rcuwalk_barrier - invalidate in-progress rcu-walk lookups * dentry_rcuwalk_barrier - invalidate in-progress rcu-walk lookups
* @dentry: the target dentry * @dentry: the target dentry
...@@ -513,11 +522,7 @@ dentry_kill(struct dentry *dentry, int unlock_on_failure) ...@@ -513,11 +522,7 @@ dentry_kill(struct dentry *dentry, int unlock_on_failure)
if (dentry->d_op && dentry->d_op->d_release) if (dentry->d_op && dentry->d_op->d_release)
dentry->d_op->d_release(dentry); dentry->d_op->d_release(dentry);
/* if dentry was never visible to RCU, immediate free is OK */ dentry_free(dentry);
if (!(dentry->d_flags & DCACHE_RCUACCESS))
__d_free(&dentry->d_u.d_rcu);
else
call_rcu(&dentry->d_u.d_rcu, __d_free);
return parent; return parent;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册