From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: Mark Fasheh <mfasheh@suse.com>
Cc: linux-fsdevel@vger.kernel.org, Sage Weil <sage@newdream.net>,
Andreas Dilger <adilger@sun.com>
Subject: Re: [PATCH 3/2] [RFC] NFS: Support the AT_NO_TIMES and AT_STRICT fstatat flags
Date: Tue, 07 Apr 2009 15:18:05 -0700 [thread overview]
Message-ID: <1239142685.8424.9.camel@heimdal.trondhjem.org> (raw)
In-Reply-To: <20090407080107.GR14571@wotan.suse.de>
If the kernel knows that the application doesn't care about the time
information, then we can avoid having to flush out writes, and we can avoid
revalidating the atime information.
OTOH, if the app sets AT_STRICT then we must force a revalidation of the
attribute metadata.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
---
fs/nfs/inode.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 67db3a9..76bd229 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -506,9 +506,14 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat,
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 & AT_STRICT) != 0;
+
+ if (!(flags & AT_NO_TIMES))
+ goto do_revalidate;
+
/*
* Flush out writes to the server in order to update c/mtime.
*
@@ -531,11 +536,12 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat,
* - 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);
--
Trond Myklebust
Linux NFS client maintainer
NetApp
Trond.Myklebust@netapp.com
www.netapp.com
next prev parent reply other threads:[~2009-04-07 22:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-07 8:01 [PATCH 2/2] [RFC] sys_fstatat: Update file systems for new ->getattr callback Mark Fasheh
2009-04-07 22:18 ` Trond Myklebust [this message]
2009-04-07 22:47 ` [PATCH 3/2] [RFC] NFS: Support the AT_NO_TIMES and AT_STRICT fstatat flags Oleg Drokin
2009-04-07 23:07 ` Trond Myklebust
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=1239142685.8424.9.camel@heimdal.trondhjem.org \
--to=trond.myklebust@netapp.com \
--cc=adilger@sun.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mfasheh@suse.com \
--cc=sage@newdream.net \
/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).