Re: [Cluster-devel] [PATCH V11 03/19] block: introduce bio_for_each_bvec()

2018-11-22 Thread Ming Lei
On Thu, Nov 22, 2018 at 11:30:33AM +0100, Christoph Hellwig wrote: > Btw, this patch instead of the plain rever might make it a little > more clear what is going on by skipping the confusing helper altogher > and operating on the raw bvec array: > > > diff --git a/include/linux/bio.h

Re: [Cluster-devel] [PATCH V11 03/19] block: introduce bio_for_each_bvec()

2018-11-22 Thread Christoph Hellwig
Btw, this patch instead of the plain rever might make it a little more clear what is going on by skipping the confusing helper altogher and operating on the raw bvec array: diff --git a/include/linux/bio.h b/include/linux/bio.h index e5b975fa0558..926550ce2d21 100644 --- a/include/linux/bio.h

Re: [Cluster-devel] [PATCH V11 03/19] block: introduce bio_for_each_bvec()

2018-11-22 Thread Christoph Hellwig
On Thu, Nov 22, 2018 at 06:15:28PM +0800, Ming Lei wrote: > > while (bytes) { > > - unsigned segment_len = segment_iter_len(bv, *iter); > > - > > - if (max_seg_len < BVEC_MAX_LEN) > > - segment_len = min_t(unsigned, segment_len, > > -

Re: [Cluster-devel] [PATCH V11 03/19] block: introduce bio_for_each_bvec()

2018-11-22 Thread Ming Lei
On Wed, Nov 21, 2018 at 06:12:17PM +0100, Christoph Hellwig wrote: > On Wed, Nov 21, 2018 at 05:10:25PM +0100, Christoph Hellwig wrote: > > No - I think we can always use the code without any segment in > > bvec_iter_advance. Because bvec_iter_advance only operates on the > > iteractor, the

Re: [Cluster-devel] [PATCH V11 03/19] block: introduce bio_for_each_bvec()

2018-11-21 Thread Ming Lei
On Wed, Nov 21, 2018 at 05:10:25PM +0100, Christoph Hellwig wrote: > On Wed, Nov 21, 2018 at 11:31:36PM +0800, Ming Lei wrote: > > > But while looking over this I wonder why we even need the max_seg_len > > > here. The only thing __bvec_iter_advance does it to move bi_bvec_done > > > and bi_idx

Re: [Cluster-devel] [PATCH V11 03/19] block: introduce bio_for_each_bvec()

2018-11-21 Thread Christoph Hellwig
On Wed, Nov 21, 2018 at 05:10:25PM +0100, Christoph Hellwig wrote: > No - I think we can always use the code without any segment in > bvec_iter_advance. Because bvec_iter_advance only operates on the > iteractor, the generation of an actual single-page or multi-page > bvec is left to the caller

Re: [Cluster-devel] [PATCH V11 03/19] block: introduce bio_for_each_bvec()

2018-11-21 Thread Christoph Hellwig
On Wed, Nov 21, 2018 at 11:31:36PM +0800, Ming Lei wrote: > > But while looking over this I wonder why we even need the max_seg_len > > here. The only thing __bvec_iter_advance does it to move bi_bvec_done > > and bi_idx forward, with corresponding decrements of bi_size. As far > > as I can tell

Re: [Cluster-devel] [PATCH V11 03/19] block: introduce bio_for_each_bvec()

2018-11-21 Thread Ming Lei
On Wed, Nov 21, 2018 at 02:32:44PM +0100, Christoph Hellwig wrote: > > +#define bio_iter_mp_iovec(bio, iter) \ > > + segment_iter_bvec((bio)->bi_io_vec, (iter)) > > Besides the mp naming we'd like to get rid off there also is just > a single user of this macro,

Re: [Cluster-devel] [PATCH V11 03/19] block: introduce bio_for_each_bvec()

2018-11-21 Thread Christoph Hellwig
> +#define bio_iter_mp_iovec(bio, iter) \ > + segment_iter_bvec((bio)->bi_io_vec, (iter)) Besides the mp naming we'd like to get rid off there also is just a single user of this macro, please just expand it there. > +#define segment_iter_bvec(bvec, iter)

[Cluster-devel] [PATCH V11 03/19] block: introduce bio_for_each_bvec()

2018-11-20 Thread Ming Lei
This helper is used for iterating over multi-page bvec for bio split & merge code. Reviewed-by: Omar Sandoval Signed-off-by: Ming Lei --- include/linux/bio.h | 25 ++--- include/linux/bvec.h | 36 +--- 2 files changed, 51 insertions(+), 10