linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@fb.com>,
	Nicholas Bellinger <nab@linux-iscsi.org>,
	Ming Lei <ming.lei@canonical.com>,
	linux-fsdevel@vger.kernel.org, target-devel@vger.kernel.org
Subject: Re: [PATCH 1/3] fs: add vfs_bvec_{read,write} helpers
Date: Fri, 23 Jan 2015 06:00:49 +0000	[thread overview]
Message-ID: <20150123060049.GD29656@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1421593624-4462-2-git-send-email-hch@lst.de>

On Sun, Jan 18, 2015 at 04:07:02PM +0100, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/read_write.c    | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  fs/splice.c        | 23 +++------------------
>  include/linux/fs.h |  5 +++++
>  3 files changed, 68 insertions(+), 20 deletions(-)
> 
> diff --git a/fs/read_write.c b/fs/read_write.c
> index c0805c9..299e262 100644
> --- a/fs/read_write.c
> +++ b/fs/read_write.c
> @@ -333,6 +333,66 @@ out_putf:
>  }
>  #endif
>  
> +ssize_t vfs_bvec_read(struct file *file, struct bio_vec *vec,
> +		unsigned long nr_segs, size_t count, loff_t *ppos)
> +{
> +	struct iov_iter iter;
> +	struct kiocb kiocb;
> +	ssize_t ret;
> +
> +	if (!file->f_op->read_iter)
> +		return -EBADFD;

#define EBADFD          77      /* File descriptor in bad state */

Looks really odd.  For crying out loud, what's a STREAMS-related error
doing here?  What's more, it's a bloody awful one - spelling is too
similar to EBADF and it's really asking for typos that end up as
uncaught rarely-triggered bugs.

> +	iter.type = ITER_BVEC | READ;
> +	iter.bvec = vec;
> +	iter.nr_segs = nr_segs;
> +	iter.count = count;
> +	iter.iov_offset = 0;

iov_iter_bvec(), please (see vfs.git#for-next).

> +ssize_t vfs_bvec_write(struct file *file, struct bio_vec *vec,
> +		unsigned long nr_segs, size_t count, loff_t *ppos)

Same comments here.  I can pick that, but EBADFD is awful and I would
very much prefer to avoid it from the very beginning.

  reply	other threads:[~2015-01-23  6:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-18 15:07 switch loop and target to use ITER_BVEC iov_iter Christoph Hellwig
2015-01-18 15:07 ` [PATCH 1/3] fs: add vfs_bvec_{read,write} helpers Christoph Hellwig
2015-01-23  6:00   ` Al Viro [this message]
2015-01-18 15:07 ` [PATCH 2/3] loop: convert to vfs_bvec_write Christoph Hellwig
2015-01-18 15:07 ` [PATCH 3/3] target: use vfs_bvec_read/write Christoph Hellwig
2015-01-18 15:37   ` Sagi Grimberg
2015-01-20 23:32   ` Nicholas A. Bellinger
2015-01-23 14:08   ` Ming Lei
2015-01-25 13:43     ` Christoph Hellwig
2015-01-26  2:02       ` Ming Lei
2015-01-26 16:59         ` Christoph Hellwig
2015-01-27  5:14           ` Ming Lei
2015-01-22  4:11 ` switch loop and target to use ITER_BVEC iov_iter Ming Lei
2015-01-25 13:45   ` Christoph Hellwig

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=20150123060049.GD29656@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=axboe@fb.com \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=ming.lei@canonical.com \
    --cc=nab@linux-iscsi.org \
    --cc=target-devel@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).