From: npiggin@suse.de Subject: [patch 25/52] fs: dcache DCACHE_REFERENCED improve Date: Thu, 24 Jun 2010 13:02:37 +1000 Message-ID: <20100624030729.566820679@suse.de> References: <20100624030212.676457061@suse.de> Cc: John Stultz , Frank Mayhar To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Return-path: Content-Disposition: inline; filename=fs-dput-d_referenced-improve.patch Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org 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 Index: linux-2.6/fs/dcache.c =================================================================== --- linux-2.6.orig/fs/dcache.c +++ linux-2.6/fs/dcache.c @@ -387,10 +387,10 @@ repeat: /* 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 */ + if (list_empty(&dentry->d_lru)) dentry_lru_add(dentry); - } + dentry->d_flags |= DCACHE_REFERENCED; dentry->d_count--; spin_unlock(&dentry->d_lock); return;