Re: [PATCH 2/5] block: add support for copy offload

Keith Busch
2025-05-23T13:26:48Z

On Fri, May 23, 2025 at 05:46:57AM -0700, Christoph Hellwig wrote:
> On Wed, May 21, 2025 at 03:31:04PM -0700, Keith Busch wrote:
> > struct bio_vec {
> > - struct page *bv_page;
> > - unsigned int bv_len;
> > - unsigned int bv_offset;
> > + union {
> > + struct {
> > + struct page *bv_page;
> > + unsigned int bv_len;
> > + unsigned int bv_offset;
> > + };
> > + struct {
> > + sector_t bv_sector;
> > + sector_t bv_sectors;
> > + };
> > + };
>
> Urrgg. Please don't overload the bio_vec. We've been working hard to
> generalize it and share the data structures with more users in the
> block layer.

Darn, this part of the proposal is really the core concept of this patch
set that everything builds around. It's what allows submitting
arbitrarily large sized copy requests and letting the block layer
efficiently split a bio to the queue limits later.

> If having a bio for each source range is too much overhead
> for your user case (but I'd like to numbers for that), we'll need to
> find a way to do that without overloading the actual bio_vec structure.

Getting good numbers might be a problem in the near term. The current
generation of devices I have access to that can do copy offload don't
have asic support for it, so it is instrumented entirely in firmware.
The performance is currently underwhelming, but I expect next generation
to be much better.