On Tue, Nov 21, 2023 at 04:37:01PM +0800, Ming Lei wrote: > On Mon, Nov 20, 2023 at 02:40:54PM -0800, Keith Busch wrote: > > From: Keith Busch <kbusch@xxxxxxxxxx> > > > > Some bio_vec iterators can handle physically contiguous memory and have > > no need to split bvec consideration on page boundaries. > > Then I am wondering why this helper is needed, and you can use each bvec > directly, which is supposed to be physically contiguous. It's just a helper function to iterate a generic bvec. > > diff --git a/include/linux/bvec.h b/include/linux/bvec.h > > index 555aae5448ae4..9364c258513e0 100644 > > --- a/include/linux/bvec.h > > +++ b/include/linux/bvec.h > > @@ -184,6 +184,12 @@ static inline void bvec_iter_advance_single(const struct bio_vec *bv, > > ((bvl = bvec_iter_bvec((bio_vec), (iter))), 1); \ > > bvec_iter_advance_single((bio_vec), &(iter), (bvl).bv_len)) > > > > +#define for_each_mp_bvec(bvl, bio_vec, iter, start) \ > > + for (iter = (start); \ > > + (iter).bi_size && \ > > + ((bvl = mp_bvec_iter_bvec((bio_vec), (iter))), 1); \ > > + bvec_iter_advance_single((bio_vec), &(iter), (bvl).bv_len)) > > + > > We already have bio_for_each_bvec() to iterate over (multipage)bvecs > from bio. Right, but we are not dealing with a bio here. We have a bip bvec instead, so can't use bio_for_each_bvec().