From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleg Drokin Subject: [PATCH 2/3] Update all filesystems with extra argument to getattr inode operation (with patch now) Date: Wed, 8 Apr 2009 03:28:19 +0400 Message-ID: <20090407232819.GA1571300@fiona.linuxhacker.ru> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="BOKacYhQ+x31HxR3" To: linux-fsdevel@vger.kernel.org Return-path: Received: from linuxhacker.ru ([217.76.32.60]:47469 "EHLO fiona.linuxhacker.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755124AbZDGX2V (ORCPT ); Tue, 7 Apr 2009 19:28:21 -0400 Received: from fiona.linuxhacker.ru (fiona [127.0.0.1]) by fiona.linuxhacker.ru (8.14.3/8.14.2) with ESMTP id n37NSJq31571373 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 8 Apr 2009 03:28:19 +0400 Received: (from green@localhost) by fiona.linuxhacker.ru (8.14.3/8.14.3/Submit) id n37NSJt91571372 for linux-fsdevel@vger.kernel.org; Wed, 8 Apr 2009 03:28:19 +0400 Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline This is the "foot in the door" fs user for the flags in getattr in NFS. This is Trond's patch updated to more fine-grained flags. --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="stat_light_nfs.diff" If the kernel knows that the application doesn't care about the atime information, then we can avoid having to flush out writes, and we can avoid revalidating the atime information. OTOH, if the app sets STAT_REVALIDATE then we must force a revalidation of the attribute metadata. inode.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) Index: linux-2.6.29/fs/nfs/inode.c =================================================================== --- linux-2.6.29.orig/fs/nfs/inode.c 2009-04-07 18:50:41.000000000 -0400 +++ linux-2.6.29/fs/nfs/inode.c 2009-04-07 18:53:56.000000000 -0400 @@ -475,9 +475,14 @@ int flags) { struct inode *inode = dentry->d_inode; - int need_atime = NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATIME; + int force_reval = 0; int err; + force_reval |= (flags & STAT_REVALIDATE) != 0; + + if (flags & STAT_ATIME) + goto do_revalidate; + /* * Flush out writes to the server in order to update c/mtime. * @@ -500,11 +505,12 @@ * - NFS never sets MS_NOATIME or MS_NODIRATIME so there is * no point in checking those. */ - if ((mnt->mnt_flags & MNT_NOATIME) || - ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode))) - need_atime = 0; + if (!((mnt->mnt_flags & MNT_NOATIME) || + ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode)))) + force_reval |= (NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATIME) != 0; - if (need_atime) +do_revalidate: + if (force_reval) err = __nfs_revalidate_inode(NFS_SERVER(inode), inode); else err = nfs_revalidate_inode(NFS_SERVER(inode), inode); --BOKacYhQ+x31HxR3--