From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kara Subject: Re: [PATCH] VFS: Go through the LRU list of inode from head Date: Thu, 21 Jun 2012 11:52:23 +0200 Message-ID: <20120621095223.GA11645@quack.suse.cz> References: <1340269227-20310-1-git-send-email-mc@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Al Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org To: Cong Meng Return-path: Content-Disposition: inline In-Reply-To: <1340269227-20310-1-git-send-email-mc@linux.vnet.ibm.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Thu 21-06-12 17:00:27, Cong Meng wrote: > Go through the LRU list of inode from head. > > (I'm not sure whether there is any trick here I doesn't get. If yes, > any one could explain it) Look at inode_lru_list_add(). It adds at the head of the list. So you should take from the tail to get the least recently used element... Honza > > Signed-off-by: Cong Meng > --- > fs/inode.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/fs/inode.c b/fs/inode.c > index 775cbab..aac8449 100644 > --- a/fs/inode.c > +++ b/fs/inode.c > @@ -704,7 +704,7 @@ void prune_icache_sb(struct super_block *sb, int nr_to_scan) > if (list_empty(&sb->s_inode_lru)) > break; > > - inode = list_entry(sb->s_inode_lru.prev, struct inode, i_lru); > + inode = list_entry(sb->s_inode_lru.next, struct inode, i_lru); > > /* > * we are inverting the sb->s_inode_lru_lock/inode->i_lock here, > -- > 1.7.5.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Jan Kara SUSE Labs, CR