lkml.org 
[lkml]   [2014]   [Dec]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 08/17] block: refactor __bio_copy_iov()
On 23.12.2014 02:45, Christoph Hellwig wrote:
> > 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?

Agreed.

> > 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?

Agreed. I'll update it in the next round.

Thanks,
Dongsu


\
 
 \ /
  Last update: 2014-12-23 14:01    [W:0.059 / U:1.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site