On Mon, Jul 19, 2021 at 07:39:46PM +0100, Matthew Wilcox (Oracle) wrote: > #define bio_for_each_bvec_all(bvl, bio, i) \ > for (i = 0, bvl = bio_first_bvec_all(bio); \ > - i < (bio)->bi_vcnt; i++, bvl++) \ > + i < (bio)->bi_vcnt; i++, bvl++) Pleae split out this unrelated fixup. > +static inline > +void bio_first_folio(struct folio_iter *fi, struct bio *bio, int i) Please fix the strange formatting. > +{ > + struct bio_vec *bvec = bio_first_bvec_all(bio) + i; > + > + fi->folio = page_folio(bvec->bv_page); > + fi->offset = bvec->bv_offset + > + PAGE_SIZE * (bvec->bv_page - &fi->folio->page); Can we have a little helper for the offset in folio calculation, like: static inline size_t offset_of_page_in_folio(struct page *page) { return (bvec->bv_page - &page_folio(page)->page) * PAGE; } as that makes the callers a lot easier to read.