Re: [PATCH 1/5] block: new sector copy api

Keith Busch
2025-05-22T16:43:35Z

On Thu, May 22, 2025 at 12:02:07PM +0200, Hannes Reinecke wrote:
> > +/**
> > + * blkdev_copy - copy source sectors to a destination on the same block device
> > + * @dst_sector: start sector of the destination to copy to
> > + * @src_sector: start sector of the source to copy from
> > + * @nr_sects: number of sectors to copy
> > + * @gfp: allocation flags to use
> > + */
> > +int blkdev_copy(struct block_device *bdev, sector_t dst_sector,
> > + sector_t src_sector, sector_t nr_sects, gfp_t gfp)
> > +{
>
> Hmm. This interface is for copies _within_ the same bdev only.
> Shouldn't we rather expand it to have _two_ bdev arguments to
> eventually handle copies between bdevs?
> In the end the function itself wouldn't change...

Sure. To start, I think it could just fallback to the non-offloaded
instrumented "copy" path if you have two different bdevs. Utilizing copy
offload across multiple devices is a bit more complex, so I'm focusing
on simple copy for now, but want to leave it flexible enough for such
future enhancements too.