diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2018-02-23 22:11:34 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2018-03-29 15:07:42 -0400 |
commit | 8b987a46a1e0e93d4cb4babea06ea274e2e2b658 (patch) | |
tree | 3aef2007f7a60a820066cd3c1203d66bb3eee810 /fs/dcache.c | |
parent | 65d8eb5a8f5480756105173de147ef5d60163e2f (diff) |
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.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index 916fd57b9d18..61819fb32e13 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -588,13 +588,9 @@ static void __dentry_kill(struct dentry *dentry) | |||
588 | dentry_free(dentry); | 588 | dentry_free(dentry); |
589 | } | 589 | } |
590 | 590 | ||
591 | static inline struct dentry *lock_parent(struct dentry *dentry) | 591 | static struct dentry *__lock_parent(struct dentry *dentry) |
592 | { | 592 | { |
593 | struct dentry *parent = dentry->d_parent; | 593 | struct dentry *parent; |
594 | if (IS_ROOT(dentry)) | ||
595 | return NULL; | ||
596 | if (likely(spin_trylock(&parent->d_lock))) | ||
597 | return parent; | ||
598 | rcu_read_lock(); | 594 | rcu_read_lock(); |
599 | spin_unlock(&dentry->d_lock); | 595 | spin_unlock(&dentry->d_lock); |
600 | again: | 596 | again: |
@@ -620,6 +616,16 @@ again: | |||
620 | return parent; | 616 | return parent; |
621 | } | 617 | } |
622 | 618 | ||
619 | static inline struct dentry *lock_parent(struct dentry *dentry) | ||
620 | { | ||
621 | struct dentry *parent = dentry->d_parent; | ||
622 | if (IS_ROOT(dentry)) | ||
623 | return NULL; | ||
624 | if (likely(spin_trylock(&parent->d_lock))) | ||
625 | return parent; | ||
626 | return __lock_parent(dentry); | ||
627 | } | ||
628 | |||
623 | /* | 629 | /* |
624 | * Finish off a dentry we've decided to kill. | 630 | * Finish off a dentry we've decided to kill. |
625 | * dentry->d_lock must be held, returns with it unlocked. | 631 | * dentry->d_lock must be held, returns with it unlocked. |