linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Drokin <green@linuxhacker.ru>
To: linux-fsdevel@vger.kernel.org
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	[thread overview]
Message-ID: <20090407232819.GA1571300@fiona.linuxhacker.ru> (raw)

[-- Attachment #1: Type: text/plain, Size: 130 bytes --]

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.

[-- Attachment #2: stat_light_nfs.diff --]
[-- Type: text/plain, Size: 1603 bytes --]

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);

                 reply	other threads:[~2009-04-07 23:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090407232819.GA1571300@fiona.linuxhacker.ru \
    --to=green@linuxhacker.ru \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).