aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2018-03-06 21:37:31 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2018-03-29 15:07:43 -0400
commit62d9956cefe6ecc4b43a7fae37af78ba7adaceaa (patch)
tree69dbdfaff2becc56b3d2fd50f02280d742df0f31
parenta338579f2f3d6a15c78f1dc7de4c248b4183fcea (diff)
handle move to LRU in retain_dentry()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/dcache.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 4208376497f4..f5609902c6dd 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -440,17 +440,6 @@ static void d_lru_shrink_move(struct list_lru_one *lru, struct dentry *dentry,
440 list_lru_isolate_move(lru, &dentry->d_lru, list); 440 list_lru_isolate_move(lru, &dentry->d_lru, list);
441} 441}
442 442
443/*
444 * dentry_lru_(add|del)_list) must be called with d_lock held.
445 */
446static void dentry_lru_add(struct dentry *dentry)
447{
448 if (unlikely(!(dentry->d_flags & DCACHE_LRU_LIST)))
449 d_lru_add(dentry);
450 else if (unlikely(!(dentry->d_flags & DCACHE_REFERENCED)))
451 dentry->d_flags |= DCACHE_REFERENCED;
452}
453
454/** 443/**
455 * d_drop - drop a dentry 444 * d_drop - drop a dentry
456 * @dentry: dentry to drop 445 * @dentry: dentry to drop
@@ -641,6 +630,12 @@ static inline bool retain_dentry(struct dentry *dentry)
641 if (dentry->d_op->d_delete(dentry)) 630 if (dentry->d_op->d_delete(dentry))
642 return false; 631 return false;
643 } 632 }
633 /* retain; LRU fodder */
634 dentry->d_lockref.count--;
635 if (unlikely(!(dentry->d_flags & DCACHE_LRU_LIST)))
636 d_lru_add(dentry);
637 else if (unlikely(!(dentry->d_flags & DCACHE_REFERENCED)))
638 dentry->d_flags |= DCACHE_REFERENCED;
644 return true; 639 return true;
645} 640}
646 641
@@ -823,8 +818,6 @@ repeat:
823 rcu_read_unlock(); 818 rcu_read_unlock();
824 819
825 if (likely(retain_dentry(dentry))) { 820 if (likely(retain_dentry(dentry))) {
826 dentry_lru_add(dentry);
827 dentry->d_lockref.count--;
828 spin_unlock(&dentry->d_lock); 821 spin_unlock(&dentry->d_lock);
829 return; 822 return;
830 } 823 }