Commit 8b987a46 authored by Al Viro's avatar Al Viro

split the slow part of lock_parent() off

Turn the "trylock failed" part into uninlined __lock_parent().
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 65d8eb5a
...@@ -588,13 +588,9 @@ static void __dentry_kill(struct dentry *dentry) ...@@ -588,13 +588,9 @@ static void __dentry_kill(struct dentry *dentry)
dentry_free(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; struct dentry *parent;
if (IS_ROOT(dentry))
return NULL;
if (likely(spin_trylock(&parent->d_lock)))
return parent;
rcu_read_lock(); rcu_read_lock();
spin_unlock(&dentry->d_lock); spin_unlock(&dentry->d_lock);
again: again:
...@@ -620,6 +616,16 @@ static inline struct dentry *lock_parent(struct dentry *dentry) ...@@ -620,6 +616,16 @@ static inline struct dentry *lock_parent(struct dentry *dentry)
return parent; 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. * Finish off a dentry we've decided to kill.
* dentry->d_lock must be held, returns with it unlocked. * dentry->d_lock must be held, returns with it unlocked.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment