On 7/27/24 9:30 AM, Jens Axboe wrote: > On 7/26/24 4:48 PM, Linus Torvalds wrote: >> I didn't even look at what the issue was with the >> bio_for_each_segment() expansion, in the hope that Jens will make that >> one look better. > > I did take a quick look, pretty obviously bvec_iter_bvec() which makes > it horrible, which came from Kent's immutable work quite a while ago. > Not sure yet what to do about it, will spend some time on this next > week. Maybe something like this, totally untested... diff --git a/include/linux/bvec.h b/include/linux/bvec.h index f41c7f0ef91e..9ccccddadde2 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -130,12 +130,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(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