Re: [PATCH 1/3] fs: add vfs_bvec_{read,write} helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jan 18, 2015 at 04:07:02PM +0100, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> ---
>  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.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux