[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141223104551.GC27600@infradead.org>
Date: Tue, 23 Dec 2014 02:45:51 -0800
From: Christoph Hellwig <hch@...radead.org>
To: Dongsu Park <dongsu.park@...fitbricks.com>
Cc: linux-kernel@...r.kernel.org, Jens Axboe <axboe@...nel.dk>,
Kent Overstreet <kmo@...erainc.com>,
Ming Lin <mlin@...ggr.net>, Al Viro <viro@...iv.linux.org.uk>
Subject: Re: [RFC PATCH 08/17] block: refactor __bio_copy_iov()
> static int __bio_copy_iov(struct bio *bio, const struct iov_iter *iter,
> + int to_iov)
> {
> + int i;
> struct bio_vec *bvec;
> struct iov_iter iov_iter = *iter;
Why not pass the iov_iter by value?
> bio_for_each_segment_all(bvec, bio, i) {
> + ssize_t ret;
> +
> + if (to_iov == WRITE)
> + ret = copy_page_to_iter(bvec->bv_page,
> + bvec->bv_offset,
> + bvec->bv_len,
> + &iov_iter);
> + else
> + ret = copy_page_from_iter(bvec->bv_page,
> + bvec->bv_offset,
> + bvec->bv_len,
> + &iov_iter);
> +
> + if (!iov_iter_count(&iov_iter))
> + break;
>
> + if (ret < bvec->bv_len)
> + return -EFAULT;
> }
>
> + return 0;
Seems like this should be split into two functions for the read
and write cases?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists