diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-04-29 23:40:14 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-04-30 18:02:52 -0400 |
commit | b4f0354e968f5fabd39bc85b99fedae4a97589fe (patch) | |
tree | 39ffc288a0e49877f0ea83db584fd857df87bbbc /fs/dcache.c | |
parent | 5c47e6d0ad608987b91affbcf7d1fc12dfbe8fb4 (diff) |
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: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index a5540d491954..dab7db10d685 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -246,6 +246,15 @@ static void __d_free(struct rcu_head *head) | |||
246 | kmem_cache_free(dentry_cache, dentry); | 246 | kmem_cache_free(dentry_cache, dentry); |
247 | } | 247 | } |
248 | 248 | ||
249 | static void dentry_free(struct dentry *dentry) | ||
250 | { | ||
251 | /* if dentry was never visible to RCU, immediate free is OK */ | ||
252 | if (!(dentry->d_flags & DCACHE_RCUACCESS)) | ||
253 | __d_free(&dentry->d_u.d_rcu); | ||
254 | else | ||
255 | call_rcu(&dentry->d_u.d_rcu, __d_free); | ||
256 | } | ||
257 | |||
249 | /** | 258 | /** |
250 | * dentry_rcuwalk_barrier - invalidate in-progress rcu-walk lookups | 259 | * dentry_rcuwalk_barrier - invalidate in-progress rcu-walk lookups |
251 | * @dentry: the target dentry | 260 | * @dentry: the target dentry |
@@ -513,11 +522,7 @@ relock: | |||
513 | if (dentry->d_op && dentry->d_op->d_release) | 522 | if (dentry->d_op && dentry->d_op->d_release) |
514 | dentry->d_op->d_release(dentry); | 523 | dentry->d_op->d_release(dentry); |
515 | 524 | ||
516 | /* if dentry was never visible to RCU, immediate free is OK */ | 525 | dentry_free(dentry); |
517 | if (!(dentry->d_flags & DCACHE_RCUACCESS)) | ||
518 | __d_free(&dentry->d_u.d_rcu); | ||
519 | else | ||
520 | call_rcu(&dentry->d_u.d_rcu, __d_free); | ||
521 | return parent; | 526 | return parent; |
522 | } | 527 | } |
523 | 528 | ||