On Thu, May 02, 2024 at 08:45:33AM +0200, Hannes Reinecke wrote: >> - 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, page); > > Errm. I guess you need to call 'folio_put()' here, otherwise the page > reference counting will be messed up. It shouldn't. See the rfc patch and explanation that Keith sent in reply to the previous version. But as I wrote earlier it should be a separate prep patch including a commit log clearly explaining the reason for it and how it works. > That is not a valid conversion. > bvec_try_to_merge_pages() will try to merge a page with an existing > bvec. If the logic is switch to folios you would need to iterate over > all pages in a folio, and call bvec_try_to_merge_pages() for each page > in the folio. > Or convert / add a function 'bvec_try_to_merge_folio()'. > But with the above patch it will only ever try to merge the first page > in the folio. You mean bvec_try_merge_page? The only place where it uses more informtation than just the physical address is for the same_page logic. That beeing said converting it to a folio would still be a good idea and a good prep patch.