On Sat, Jul 27, 2024 at 10:52:32AM GMT, Jens Axboe wrote: > On 7/27/24 10:41 AM, Lorenzo Stoakes wrote: > >>> Patch attached including Jens's change + mine. > >> > >> bvec side matches what I have here, fwiw, except I also did > >> mp_bvec_iter_len(). Didn't see big expansion there, but might as well > >> keep them consistent. > > > > Makes sense, am happy to give R-b tag for this patch if you want to put it > > forward? Not sure if Linus is minded to just pull something for this now? > > Here's what I built (allmodconfig, gcc-14 and clang-20) and did a basic > boot of. Was just going to shove it into the 6.12 queue once posted, but > can go either way with this. Or Linus can just grab it and run with it, > not super particular ;-) Yeah looks good to me, either way have: Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx> > > > If we're whack-a-moleing may as well sort the drivers I found in my > > allmodconfig too obviously as some hilariously low-hanging fruit there... > > Oh I'm not, I got plenty of other things to tend to. Just got sucked > into the block side as that looked nuts, wanted to make that wasn't > insane. > Fully understandable, and it is the weekend after all :) As I am clearly a bit bored this w/e, I might take a look at the obvious bits there myself if Linus hasn't already patched... Have an allmodconfig build going now. > > diff --git a/include/linux/bvec.h b/include/linux/bvec.h > index f41c7f0ef91e..1cb76a829b83 100644 > --- a/include/linux/bvec.h > +++ b/include/linux/bvec.h > @@ -101,9 +101,14 @@ struct bvec_iter_all { > #define mp_bvec_iter_page(bvec, iter) \ > (__bvec_iter_bvec((bvec), (iter))->bv_page) > > -#define mp_bvec_iter_len(bvec, iter) \ > - min((iter).bi_size, \ > - __bvec_iter_bvec((bvec), (iter))->bv_len - (iter).bi_bvec_done) > +static inline unsigned mp_bvec_iter_len(const struct bio_vec *bvec, > + struct bvec_iter iter) > +{ > + unsigned remains = __bvec_iter_bvec(bvec, iter)->bv_len - > + iter.bi_bvec_done; > + > + return remains < iter.bi_size ? remains : iter.bi_size; > +} > > #define mp_bvec_iter_offset(bvec, iter) \ > (__bvec_iter_bvec((bvec), (iter))->bv_offset + (iter).bi_bvec_done) > @@ -111,12 +116,15 @@ struct bvec_iter_all { > #define mp_bvec_iter_page_idx(bvec, iter) \ > (mp_bvec_iter_offset((bvec), (iter)) / PAGE_SIZE) > > -#define mp_bvec_iter_bvec(bvec, iter) \ > -((struct bio_vec) { \ > - .bv_page = mp_bvec_iter_page((bvec), (iter)), \ > - .bv_len = mp_bvec_iter_len((bvec), (iter)), \ > - .bv_offset = mp_bvec_iter_offset((bvec), (iter)), \ > -}) > +static inline struct bio_vec mp_bvec_iter_bvec(const struct bio_vec *bv, > + struct bvec_iter iter) > +{ > + return (struct bio_vec) { > + .bv_page = mp_bvec_iter_page(bv, iter), > + .bv_len = mp_bvec_iter_len(bv, iter), > + .bv_offset = mp_bvec_iter_offset(bv, iter) > + }; > +} > > /* For building single-page bvec in flight */ > #define bvec_iter_offset(bvec, iter) \ > @@ -130,12 +138,15 @@ struct bvec_iter_all { > (mp_bvec_iter_page((bvec), (iter)) + \ > mp_bvec_iter_page_idx((bvec), (iter))) > > -#define bvec_iter_bvec(bvec, iter) \ > -((struct bio_vec) { \ > - .bv_page = bvec_iter_page((bvec), (iter)), \ > - .bv_len = bvec_iter_len((bvec), (iter)), \ > - .bv_offset = bvec_iter_offset((bvec), (iter)), \ > -}) > +static inline struct bio_vec bvec_iter_bvec(const struct bio_vec *bv, > + struct bvec_iter iter) > +{ > + return (struct bio_vec) { > + .bv_page = bvec_iter_page(bv, iter), > + .bv_len = bvec_iter_len(bv, iter), > + .bv_offset = bvec_iter_offset(bv, iter) > + }; > +} > > static inline bool bvec_iter_advance(const struct bio_vec *bv, > struct bvec_iter *iter, unsigned bytes) > > -- > Jens Axboe > >