On Wed, Jun 05, 2024 at 02:54:55PM +0530, Kundan Kumar wrote: > - page = folio_page(fi.folio, fi.offset / PAGE_SIZE); > - nr_pages = (fi.offset + fi.length - 1) / PAGE_SIZE - > - fi.offset / PAGE_SIZE + 1; > - do { > - bio_release_page(bio, page++); > - } while (--nr_pages != 0); > + bio_release_page(bio, &fi.folio->page); > } Why can't we have ... bio_release_folio(bio, fi.folio, nr_pages); which is implemented as: static inline void bio_release_page(struct bio *bio, struct folio *folio, unsigned long nr_pages) { if (bio_flagged(bio, BIO_PAGE_PINNED)) gup_put_folio(folio, nr_pages, FOLL_PIN); } Sure, we'd need to make gup_put_folio() unstatic, but this seems far more sensible.