summaryrefslogtreecommitdiffstats
path: root/fs/dcache.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2018-04-15 18:31:03 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2018-04-15 23:36:58 -0400
commit1088a6408ce197bef7ba04b32e6b034e95d6d2c1 (patch)
tree9835d8983dd4a14506963de7748b7029b2f2bb05 /fs/dcache.c
parent9c5f1d30199d09f7e2776c24ecb63c843ada876d (diff)
dput(): turn into explicit while() loop
No need to mess with gotos when the code yielded by straight while() isn't any worse... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index fd4c6de17b94..c4d2234eccc3 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -828,29 +828,24 @@ static inline bool fast_dput(struct dentry *dentry)
828 */ 828 */
829void dput(struct dentry *dentry) 829void dput(struct dentry *dentry)
830{ 830{
831 if (unlikely(!dentry)) 831 while (dentry) {
832 return; 832 might_sleep();
833 833
834repeat: 834 rcu_read_lock();
835 might_sleep(); 835 if (likely(fast_dput(dentry))) {
836 rcu_read_unlock();
837 return;
838 }
836 839
837 rcu_read_lock(); 840 /* Slow case: now with the dentry lock held */
838 if (likely(fast_dput(dentry))) {
839 rcu_read_unlock(); 841 rcu_read_unlock();
840 return;
841 }
842 842
843 /* Slow case: now with the dentry lock held */ 843 if (likely(retain_dentry(dentry))) {
844 rcu_read_unlock(); 844 spin_unlock(&dentry->d_lock);
845 845 return;
846 if (likely(retain_dentry(dentry))) { 846 }
847 spin_unlock(&dentry->d_lock);
848 return;
849 }
850 847
851 dentry = dentry_kill(dentry); 848 dentry = dentry_kill(dentry);
852 if (dentry) {
853 goto repeat;
854 } 849 }
855} 850}
856EXPORT_SYMBOL(dput); 851EXPORT_SYMBOL(dput);