From: Chuck Lever <chuck.lever@oracle.com>
To: trond.myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 2/2] NFS: Don't generate a GETATTR when opening an O_DIRECT file
Date: Thu, 11 Feb 2010 14:13:59 -0500 [thread overview]
Message-ID: <4B7456F7.30807@oracle.com> (raw)
In-Reply-To: <20100211190918.2666.82008.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
On 02/11/2010 02:09 PM, Chuck Lever wrote:
> Close-to-open isn't needed for O_DIRECT files, since their data is
> never cached. So if their attribute cache hasn't expired, skip the
> GETATTR.
>
> Note that fattr->time_start is required to be set correctly by the NFS
> direct I/O paths in order for this patch to work properly.
>
> Signed-off-by: Chuck Lever<chuck.lever@oracle.com>
> ---
>
> fs/nfs/dir.c | 20 ++++++++++++++++----
> 1 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
> index 3c7f03b..367302b 100644
> --- a/fs/nfs/dir.c
> +++ b/fs/nfs/dir.c
> @@ -709,6 +709,12 @@ static int nfs_is_exclusive_create(struct inode *dir, struct nameidata *nd)
> return nd&& nfs_lookup_check_intent(nd, LOOKUP_EXCL);
> }
>
> +static bool nfs_open_odirect(struct nameidata *nd)
> +{
> + struct file *filp = nd->intent.open.file;
> + return filp&& (filp->f_flags& O_DIRECT);
> +}
> +
> /*
> * Inode and filehandle revalidation for lookups.
> *
> @@ -716,6 +722,9 @@ static int nfs_is_exclusive_create(struct inode *dir, struct nameidata *nd)
> * or if the intent information indicates that we're about to open this
> * particular file and the "nocto" mount flag is not set.
> *
> + * O_DIRECT files have no locally cached data, so close-to-open checking
> + * isn't necessary. However, their attributes must be revalidated if the
> + * cache has expired, mainly to catch the case where actimeo is zero.
Missing word...
+ * attribute cache has expired,
> */
> static inline
> int nfs_lookup_verify_inode(struct inode *inode, struct nameidata *nd)
> @@ -730,12 +739,15 @@ int nfs_lookup_verify_inode(struct inode *inode, struct nameidata *nd)
> goto out_force;
> /* This is an open(2) */
> if (nfs_lookup_check_intent(nd, LOOKUP_OPEN) != 0&&
> - !(server->flags& NFS_MOUNT_NOCTO)&&
> - (S_ISREG(inode->i_mode) ||
> - S_ISDIR(inode->i_mode)))
> - goto out_force;
> + (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))) {
> + if (nfs_open_odirect(nd))
> + goto out_conditional;
> + if (!(server->flags& NFS_MOUNT_NOCTO))
> + goto out_force;
> + }
> return 0;
> }
> +out_conditional:
> return nfs_revalidate_inode(server, inode);
> out_force:
> return __nfs_revalidate_inode(server, inode);
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
chuck[dot]lever[at]oracle[dot]com
next prev parent reply other threads:[~2010-02-11 19:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-11 19:08 [PATCH 0/2] Reduce GETATTRs during direct I/O Chuck Lever
[not found] ` <20100211185757.2666.90001.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-02-11 19:09 ` [PATCH 1/2] NFS: Too many GETATTR and ACCESS calls after " Chuck Lever
2010-02-11 19:09 ` [PATCH 2/2] NFS: Don't generate a GETATTR when opening an O_DIRECT file Chuck Lever
[not found] ` <20100211190918.2666.82008.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-02-11 19:13 ` Chuck Lever [this message]
2010-02-11 19:14 ` Trond Myklebust
2010-02-11 19:20 ` Chuck Lever
2010-02-11 19:34 ` Trond Myklebust
2010-02-11 19:41 ` Chuck Lever
2010-02-11 19:45 ` 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=4B7456F7.30807@oracle.com \
--to=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@netapp.com \
/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