Re: [dm-devel] [PATCH v11 2/9] block: Add copy offload support infrastructure

From: Nitesh Shetty
Date: Mon May 29 2023 - 12:37:30 EST


> > +/*
> > + * @bdev_in: source block device
> > + * @pos_in: source offset
> > + * @bdev_out: destination block device
> > + * @pos_out: destination offset
> > + * @len: length in bytes to be copied
> > + * @endio: endio function to be called on completion of copy operation,
> > + * for synchronous operation this should be NULL
> > + * @private: endio function will be called with this private data, should be
> > + * NULL, if operation is synchronous in nature
> > + * @gfp_mask: memory allocation flags (for bio_alloc)
> > + *
> > + * Returns the length of bytes copied or error if encountered
> > + *
> > + * Description:
> > + * Copy source offset from source block device to destination block
> > + * device. Max total length of copy is limited to MAX_COPY_TOTAL_LENGTH
> > + */
> > +int blkdev_issue_copy(struct block_device *bdev_in, loff_t pos_in,
>
> I'd have thought you'd return ssize_t here. If the two block devices
> are loopmounted xfs files, we can certainly reflink "copy" more than 2GB
> at a time.
>
> --D
>

Sure we will add this to make API future proof, but at present we do have
a limit for copy. COPY_MAX_BYTES(=128MB) at present. This limit is based
on our internal testing, we have plans to increase/remove with this
limit in future phases.

Thank you,
Nitesh Shetty