From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Xin Zhao" Subject: Re: How long can an inode structure reside in the inode_cache? Date: Sat, 10 Jun 2006 13:12:39 -0400 Message-ID: <4ae3c140606101012y6668fd5co7b7d2d453bb02397@mail.gmail.com> References: <4ae3c140606091710k7a320f2ex6390d0e01da4de9b@mail.gmail.com> <20060610121318.GQ1651@parisc-linux.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: linux-kernel , linux-fsdevel@vger.kernel.org Return-path: Received: from py-out-1112.google.com ([64.233.166.178]:51529 "EHLO py-out-1112.google.com") by vger.kernel.org with ESMTP id S1751659AbWFJRMn (ORCPT ); Sat, 10 Jun 2006 13:12:43 -0400 Received: by py-out-1112.google.com with SMTP id x31so1272586pye for ; Sat, 10 Jun 2006 10:12:39 -0700 (PDT) To: "Matthew Wilcox" In-Reply-To: <20060610121318.GQ1651@parisc-linux.org> Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org No. I guess I didn't make my question clear. My question is: Will an inode be released after the last file refers to this is closed? If so, this could bring a performance issue. Consider this case: a process open a file, read it, close it, then reopen this file, read it, close it. For every open, the inode has to be read from disk again, which make hurt performance. So I think inode should stay in inode_cache for a while, not released right after the last file stops referring it. I just want to know whether my guess is right. If it is, when will kernel release the inode, since an inode cannot stay in memory forever. xin On 6/10/06, Matthew Wilcox wrote: > On Fri, Jun 09, 2006 at 08:10:10PM -0400, Xin Zhao wrote: > > I was wondering how Linux decide to free an inode from the > > inode_cache? If a file is open, an inode structure will be created and > > put into the inode_cache, but when will this inode be free and removed > > from the inode_cache? after this file is closed? If so, this seems to > > be inefficient. > > how can you possibly release an inode while the file's still open? > look at all the information stored in the inode, like the length of the > file, last accessed time, not to mention which filesystem the inode > belongs to. >