From: Jeff Layton <jlayton-vpEMnDpepFuMZCB2o+C8xQ@public.gmane.org> To: bfields-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org Cc: linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Subject: [PATCH v4 11/16] nfsd: hook nfsd_commit up to the nfsd_file cache Date: Fri, 11 Sep 2015 06:54:37 -0400 [thread overview] Message-ID: <1441968882-7851-12-git-send-email-jeff.layton@primarydata.com> (raw) In-Reply-To: <1441968882-7851-1-git-send-email-jeff.layton-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org> Use cached filps if possible instead of opening a new one every time. Signed-off-by: Jeff Layton <jeff.layton-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org> --- fs/nfsd/vfs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index af942ff4546f..ca9dc84ca4b0 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -1034,9 +1034,9 @@ __be32 nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset, unsigned long count) { - struct file *file; - loff_t end = LLONG_MAX; - __be32 err = nfserr_inval; + struct nfsd_file *nf; + loff_t end = LLONG_MAX; + __be32 err = nfserr_inval; if (offset < 0) goto out; @@ -1046,12 +1046,12 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, goto out; } - err = nfsd_open(rqstp, fhp, S_IFREG, - NFSD_MAY_WRITE|NFSD_MAY_NOT_BREAK_LEASE, &file); + err = nfsd_file_acquire(rqstp, fhp, + NFSD_MAY_WRITE|NFSD_MAY_NOT_BREAK_LEASE, &nf); if (err) goto out; if (EX_ISSYNC(fhp->fh_export)) { - int err2 = vfs_fsync_range(file, offset, end, 0); + int err2 = vfs_fsync_range(nf->nf_file, offset, end, 0); if (err2 != -EINVAL) err = nfserrno(err2); @@ -1059,7 +1059,7 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, err = nfserr_notsupp; } - fput(file); + nfsd_file_put(nf); out: return err; } -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Jeff Layton <jlayton@poochiereds.net> To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v4 11/16] nfsd: hook nfsd_commit up to the nfsd_file cache Date: Fri, 11 Sep 2015 06:54:37 -0400 [thread overview] Message-ID: <1441968882-7851-12-git-send-email-jeff.layton@primarydata.com> (raw) In-Reply-To: <1441968882-7851-1-git-send-email-jeff.layton@primarydata.com> Use cached filps if possible instead of opening a new one every time. Signed-off-by: Jeff Layton <jeff.layton@primarydata.com> --- fs/nfsd/vfs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index af942ff4546f..ca9dc84ca4b0 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -1034,9 +1034,9 @@ __be32 nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset, unsigned long count) { - struct file *file; - loff_t end = LLONG_MAX; - __be32 err = nfserr_inval; + struct nfsd_file *nf; + loff_t end = LLONG_MAX; + __be32 err = nfserr_inval; if (offset < 0) goto out; @@ -1046,12 +1046,12 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, goto out; } - err = nfsd_open(rqstp, fhp, S_IFREG, - NFSD_MAY_WRITE|NFSD_MAY_NOT_BREAK_LEASE, &file); + err = nfsd_file_acquire(rqstp, fhp, + NFSD_MAY_WRITE|NFSD_MAY_NOT_BREAK_LEASE, &nf); if (err) goto out; if (EX_ISSYNC(fhp->fh_export)) { - int err2 = vfs_fsync_range(file, offset, end, 0); + int err2 = vfs_fsync_range(nf->nf_file, offset, end, 0); if (err2 != -EINVAL) err = nfserrno(err2); @@ -1059,7 +1059,7 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, err = nfserr_notsupp; } - fput(file); + nfsd_file_put(nf); out: return err; } -- 2.4.3
next prev parent reply other threads:[~2015-09-11 10:54 UTC|newest] Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-09-11 10:54 [PATCH v4 00/16] nfsd: open file caching Jeff Layton 2015-09-11 10:54 ` [PATCH v4 01/16] locks: change tracepoint for generic_add_lease Jeff Layton 2015-09-11 10:54 ` [PATCH v4 02/16] list_lru: add list_lru_rotate Jeff Layton 2015-09-11 10:54 ` Jeff Layton 2015-09-11 10:54 ` [PATCH v4 03/16] fs: allow __fput_sync to be used by non-kthreads and in modules Jeff Layton [not found] ` <1441968882-7851-4-git-send-email-jeff.layton-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org> 2015-09-11 14:00 ` Al Viro 2015-09-11 14:00 ` Al Viro [not found] ` <20150911140049.GN22011-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org> 2015-09-11 14:38 ` Jeff Layton 2015-09-11 14:38 ` Jeff Layton 2015-09-11 10:54 ` [PATCH v4 04/16] fsnotify: export several symbols Jeff Layton [not found] ` <1441968882-7851-1-git-send-email-jeff.layton-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org> 2015-09-11 10:54 ` [PATCH v4 05/16] locks: create a new notifier chain for lease attempts Jeff Layton 2015-09-11 10:54 ` Jeff Layton 2015-09-11 10:54 ` [PATCH v4 08/16] nfsd: add a new struct file caching facility to nfsd Jeff Layton 2015-09-11 10:54 ` Jeff Layton 2015-09-11 10:54 ` [PATCH v4 09/16] nfsd: hook up nfsd_write to the new nfsd_file cache Jeff Layton 2015-09-11 10:54 ` Jeff Layton 2015-09-11 10:54 ` [PATCH v4 10/16] nfsd: hook up nfsd_read to the " Jeff Layton 2015-09-11 10:54 ` Jeff Layton 2015-09-11 10:54 ` Jeff Layton [this message] 2015-09-11 10:54 ` [PATCH v4 11/16] nfsd: hook nfsd_commit up " Jeff Layton 2015-09-11 10:54 ` [PATCH v4 13/16] nfsd: have nfsd_test_lock use " Jeff Layton 2015-09-11 10:54 ` Jeff Layton 2015-09-11 10:54 ` [PATCH v4 15/16] nfsd: hook up nfs4_preprocess_stateid_op to " Jeff Layton 2015-09-11 10:54 ` Jeff Layton 2015-09-11 10:54 ` [PATCH v4 06/16] nfsd: move include of state.h from trace.c to trace.h Jeff Layton 2015-09-11 10:54 ` [PATCH v4 07/16] sunrpc: add a new cache_detail operation for when a cache is flushed Jeff Layton 2015-09-11 10:54 ` [PATCH v4 12/16] nfsd: convert nfs4_file->fi_fds array to use nfsd_files Jeff Layton 2015-09-11 10:54 ` [PATCH v4 14/16] nfsd: convert fi_deleg_file and ls_file fields to nfsd_file Jeff Layton 2015-09-11 10:54 ` [PATCH v4 16/16] nfsd: rip out the raparms cache Jeff Layton
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=1441968882-7851-12-git-send-email-jeff.layton@primarydata.com \ --to=jlayton-vpemndpepfumzcb2o+c8xq@public.gmane.org \ --cc=bfields-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org \ --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.