Linux block layer
 help / color / mirror / Atom feed
* bio_copy_from_iter
@ 2026-06-01 17:10 Matthew Wilcox
  2026-06-02  6:03 ` bio_copy_from_iter Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Wilcox @ 2026-06-01 17:10 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe, linux-block

I'd like to remove copy_page_to_iter() (and only have
copy_folio_to_iter()).  That led me to looking at bio_copy_to_iter().
At first glance, switching it to bio_for_each_folio_all() makes a lot of
sense -- if there are large folios involved, then we can copy an entire
folio at a time instead of a page.

But what I can't prove to my satisfaction is that every bio passed to
bio_copy_to_iter() necessarily contains folios.  That's not currently
necessary, but will become necessary in the future. [1].

But I started thinking about what we could/should do in the future
when bvecs refer only to physical addresses and not pages.  What we'll
have is a list of (phys, len) tuples and need to copy that to an iter.
We don't have an API for that today.  Should we add:

copy_phys_to_iter(phys_addr_t phys, size_t len, struct iov_iter *i);

We arguably get even more benefit by doing this as we'd no longer break the
bio up into pages or folios, but can keep the contiguous chunks.  Not that
optimising bio_uncopy_user() is going to be a particularly big win,
but this API might be useful in places that are more performance sensitive.

[1] I believe all these bvecs are constructed using
blk_rq_map_user_iov() which can end up calling bio_add_vmalloc(),
and vmalloc pages will not be folios.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-02  6:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-01 17:10 bio_copy_from_iter Matthew Wilcox
2026-06-02  6:03 ` bio_copy_from_iter Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox