On Thu, Mar 06, 2025 at 08:20:08AM +1100, Dave Chinner wrote: > > + __bio_add_page(bio, virt_to_page(bp->b_addr), > > + BBTOB(bp->b_length), > > + offset_in_page(bp->b_addr)); > > } > > How does offset_in_page() work with a high order folio? It can only > return a value between 0 and (PAGE_SIZE - 1). Yes. > i.e. shouldn't this > be: > > folio = kmem_to_folio(bp->b_addr); > > bio_add_folio_nofail(bio, folio, BBTOB(bp->b_length), > offset_in_folio(folio, bp->b_addr)); > That is also correct, but does a lot more work underneath as the bio_vecs work in terms of pages. In the long run this should use a bio_add_virt that hides all that (and the bio_vecs should move to store physical addresses). For now the above is the simplest and most efficient version.