diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2018-03-06 21:37:31 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2018-03-29 15:07:43 -0400 |
commit | 62d9956cefe6ecc4b43a7fae37af78ba7adaceaa (patch) | |
tree | 69dbdfaff2becc56b3d2fd50f02280d742df0f31 /fs/dcache.c | |
parent | a338579f2f3d6a15c78f1dc7de4c248b4183fcea (diff) | |
download | linux-stable-62d9956cefe6ecc4b43a7fae37af78ba7adaceaa.tar.gz linux-stable-62d9956cefe6ecc4b43a7fae37af78ba7adaceaa.tar.bz2 linux-stable-62d9956cefe6ecc4b43a7fae37af78ba7adaceaa.zip |
handle move to LRU in retain_dentry()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 19 |
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, list_lru_isolate_move(lru, &dentry->d_lru, list); } -/* - * dentry_lru_(add|del)_list) must be called with d_lock held. - */ -static void dentry_lru_add(struct dentry *dentry) -{ - if (unlikely(!(dentry->d_flags & DCACHE_LRU_LIST))) - d_lru_add(dentry); - else if (unlikely(!(dentry->d_flags & DCACHE_REFERENCED))) - dentry->d_flags |= DCACHE_REFERENCED; -} - /** * d_drop - drop a dentry * @dentry: dentry to drop @@ -641,6 +630,12 @@ static inline bool retain_dentry(struct dentry *dentry) if (dentry->d_op->d_delete(dentry)) return false; } + /* retain; LRU fodder */ + dentry->d_lockref.count--; + if (unlikely(!(dentry->d_flags & DCACHE_LRU_LIST))) + d_lru_add(dentry); + else if (unlikely(!(dentry->d_flags & DCACHE_REFERENCED))) + dentry->d_flags |= DCACHE_REFERENCED; return true; } @@ -823,8 +818,6 @@ repeat: rcu_read_unlock(); if (likely(retain_dentry(dentry))) { - dentry_lru_add(dentry); - dentry->d_lockref.count--; spin_unlock(&dentry->d_lock); return; } |