From: "J. Bruce Fields" <bfields@fieldses.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
Jeff Layton <jlayton@poochiereds.net>,
linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 09/10] nfsd: use vfs_iter_read/write
Date: Tue, 30 May 2017 14:02:48 -0400 [thread overview]
Message-ID: <20170530180248.GH18523@fieldses.org> (raw)
In-Reply-To: <20170527081654.15957-10-hch@lst.de>
ACK.--b.
On Sat, May 27, 2017 at 11:16:53AM +0300, Christoph Hellwig wrote:
> Instead of messing with the address limit to use vfs_read/vfs_writev.
>
> Note that this requires that exported file implement ->read_iter and
> ->write_iter. All currently exportable file systems do this.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> fs/nfsd/vfs.c | 17 +++++++----------
> 1 file changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> index 2be32955d7f2..37a03c456b38 100644
> --- a/fs/nfsd/vfs.c
> +++ b/fs/nfsd/vfs.c
> @@ -911,13 +911,12 @@ __be32 nfsd_splice_read(struct svc_rqst *rqstp,
> __be32 nfsd_readv(struct file *file, loff_t offset, struct kvec *vec, int vlen,
> unsigned long *count)
> {
> - mm_segment_t oldfs;
> + struct iov_iter iter;
> int host_err;
>
> - oldfs = get_fs();
> - set_fs(KERNEL_DS);
> - host_err = vfs_readv(file, (struct iovec __user *)vec, vlen, &offset, 0);
> - set_fs(oldfs);
> + iov_iter_kvec(&iter, READ | ITER_KVEC, vec, vlen, *count);
> + host_err = vfs_iter_read(file, &iter, &offset, 0);
> +
> return nfsd_finish_read(file, count, host_err);
> }
>
> @@ -974,7 +973,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
> unsigned long *cnt, int stable)
> {
> struct svc_export *exp;
> - mm_segment_t oldfs;
> + struct iov_iter iter;
> __be32 err = 0;
> int host_err;
> int use_wgather;
> @@ -1000,10 +999,8 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
> if (stable && !use_wgather)
> flags |= RWF_SYNC;
>
> - /* Write the data. */
> - oldfs = get_fs(); set_fs(KERNEL_DS);
> - host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, &pos, flags);
> - set_fs(oldfs);
> + iov_iter_kvec(&iter, WRITE | ITER_KVEC, vec, vlen, *cnt);
> + host_err = vfs_iter_write(file, &iter, &pos, flags);
> if (host_err < 0)
> goto out_nfserr;
> *cnt = host_err;
> --
> 2.11.0
next prev parent reply other threads:[~2017-05-30 18:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-27 8:16 clean up readv/writev helpers Christoph Hellwig
2017-05-27 8:16 ` [PATCH 01/10] fs: pass on flags in compat_writev Christoph Hellwig
2017-05-27 8:16 ` [PATCH 02/10] fs: remove do_readv_writev Christoph Hellwig
2017-05-27 8:16 ` [PATCH 03/10] fs: remove do_compat_readv_writev Christoph Hellwig
2017-05-27 8:16 ` [PATCH 04/10] fs: remove __do_readv_writev Christoph Hellwig
2017-05-27 8:16 ` [PATCH 05/10] fs: move more code into do_iter_read/do_iter_write Christoph Hellwig
2017-05-27 8:16 ` [PATCH 06/10] fs: set kernel address limit in do_loop_readv_writev Christoph Hellwig
2017-05-27 8:19 ` Christoph Hellwig
2017-05-27 8:16 ` [PATCH 07/10] fs: implement vfs_iter_read using do_iter_read Christoph Hellwig
2017-05-27 8:16 ` [PATCH 08/10] fs: implement vfs_iter_write using do_iter_write Christoph Hellwig
2017-05-27 8:16 ` [PATCH 09/10] nfsd: use vfs_iter_read/write Christoph Hellwig
2017-05-30 18:02 ` J. Bruce Fields [this message]
2017-05-27 8:16 ` [PATCH 10/10] nfsd: remove nfsd_vfs_read Christoph Hellwig
2017-05-30 18:03 ` J. Bruce Fields
2017-05-27 19:32 ` clean up readv/writev helpers Al Viro
2017-06-28 14:35 ` Christoph Hellwig
2017-06-28 16:37 ` Al Viro
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=20170530180248.GH18523@fieldses.org \
--to=bfields@fieldses.org \
--cc=hch@lst.de \
--cc=jlayton@poochiereds.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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).