summaryrefslogtreecommitdiffstats
path: root/fs/dcache.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2018-02-23 22:11:34 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2018-03-29 15:07:42 -0400
commit8b987a46a1e0e93d4cb4babea06ea274e2e2b658 (patch)
tree3aef2007f7a60a820066cd3c1203d66bb3eee810 /fs/dcache.c
parent65d8eb5a8f5480756105173de147ef5d60163e2f (diff)
downloadlinux-0-day-8b987a46a1e0e93d4cb4babea06ea274e2e2b658.tar.gz
linux-0-day-8b987a46a1e0e93d4cb4babea06ea274e2e2b658.tar.xz
split the slow part of lock_parent() off
Turn the "trylock failed" part into uninlined __lock_parent(). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 916fd57b9d18d..61819fb32e139 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -588,13 +588,9 @@ static void __dentry_kill(struct dentry *dentry)
dentry_free(dentry);
}
-static inline struct dentry *lock_parent(struct dentry *dentry)
+static struct dentry *__lock_parent(struct dentry *dentry)
{
- struct dentry *parent = dentry->d_parent;
- if (IS_ROOT(dentry))
- return NULL;
- if (likely(spin_trylock(&parent->d_lock)))
- return parent;
+ struct dentry *parent;
rcu_read_lock();
spin_unlock(&dentry->d_lock);
again:
@@ -620,6 +616,16 @@ again:
return parent;
}
+static inline struct dentry *lock_parent(struct dentry *dentry)
+{
+ struct dentry *parent = dentry->d_parent;
+ if (IS_ROOT(dentry))
+ return NULL;
+ if (likely(spin_trylock(&parent->d_lock)))
+ return parent;
+ return __lock_parent(dentry);
+}
+
/*
* Finish off a dentry we've decided to kill.
* dentry->d_lock must be held, returns with it unlocked.