aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2010-10-10 05:36:24 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2010-10-25 21:26:12 -0400
commit265ac90230257e9c035e4b0c63a0c11c5336e93c (patch)
tree7bb17007af9812137eb2060fd9ef979e049f7acd
parent312d3ca856d369bb04d0443846b85b4cdde6fa8a (diff)
fs: improve DCACHE_REFERENCED usage
dentry referenced bit is only set when installing the dentry back onto the LRU. However with lazy LRU, the dentry can already be on the LRU list at dput time, thus missing out on setting the referenced bit. Fix this. Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/dcache.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index c37a656802b..1a976d4efbe 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -246,13 +246,16 @@ repeat:
if (dentry->d_op->d_delete(dentry))
goto unhash_it;
}
+
/* Unreachable? Get rid of it */
if (d_unhashed(dentry))
goto kill_it;
- if (list_empty(&dentry->d_lru)) {
- dentry->d_flags |= DCACHE_REFERENCED;
+
+ /* Otherwise leave it cached and ensure it's on the LRU */
+ dentry->d_flags |= DCACHE_REFERENCED;
+ if (list_empty(&dentry->d_lru))
dentry_lru_add(dentry);
- }
+
spin_unlock(&dentry->d_lock);
spin_unlock(&dcache_lock);
return;