qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 1/9] block: Introduce API for copy offloading


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v3 1/9] block: Introduce API for copy offloading
Date: Thu, 10 May 2018 09:44:01 +0100
User-agent: Mutt/1.9.3 (2018-01-21)

On Wed, May 09, 2018 at 10:58:07PM +0800, Fam Zheng wrote:

Please include a commit description:

  Introduce the bdrv_co_copy_range() API for copy offloading.  Block
  drivers implementing this API support efficient copy operations that
  avoid reading each block from the source device and writing it to the
  destination devices.  Examples of copy offload primitives are SCSI
  EXTENDED COPY and Linux copy_file_range(2).

This explains the purpose of the new API.

> +/* Copy range from @bs to @dst. */

There is no @bs argument, I guess it should be @src.

What about the return value?

What about the flags?

You don't need to duplicate this information, just reference
BlockDriver.bdrv_co_copy_range_from() if you want.

> +int bdrv_co_copy_range_from(BdrvChild *src, uint64_t src_offset,
> +                            BdrvChild *dst, uint64_t dst_offset,
> +                            uint64_t bytes, BdrvRequestFlags flags)
> +{
> +    return bdrv_co_copy_range_internal(src, src_offset, dst, dst_offset,
> +                                       bytes, flags, true);
> +}
> +
> +/* Copy range from @src to @bs. Should only be called by block drivers when 
> @bs
> + * is the leaf. */

Same here.

> diff --git a/include/block/block.h b/include/block/block.h
> index cdec3639a3..72ac011b2b 100644
> --- a/include/block/block.h
> +++ b/include/block/block.h
> @@ -604,4 +604,8 @@ bool bdrv_can_store_new_dirty_bitmap(BlockDriverState 
> *bs, const char *name,
>   */
>  void bdrv_register_buf(BlockDriverState *bs, void *host, size_t size);
>  void bdrv_unregister_buf(BlockDriverState *bs, void *host);
> +
> +int bdrv_co_copy_range(BdrvChild *bs, uint64_t offset,
> +                       BdrvChild *src, uint64_t src_offset,
> +                       uint64_t bytes, BdrvRequestFlags flags);

This is the public API.  It's missing a doc comment.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]