summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorFam Zheng2018-06-01 11:26:47 +0200
committerStefan Hajnoczi2018-06-01 15:41:48 +0200
commitb5679fa49c9a70efa7bf01f6efad1a65e2349a0b (patch)
tree270d5585f5eb8e9f5928bd90ad36d5f8be691364 /block
parentiscsi: Implement copy offloading (diff)
downloadqemu-b5679fa49c9a70efa7bf01f6efad1a65e2349a0b.tar.gz
qemu-b5679fa49c9a70efa7bf01f6efad1a65e2349a0b.tar.xz
qemu-b5679fa49c9a70efa7bf01f6efad1a65e2349a0b.zip
block-backend: Add blk_co_copy_range
It's a BlockBackend wrapper of the BDS interface. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20180601092648.24614-10-famz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/block-backend.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/block/block-backend.c b/block/block-backend.c
index 89f47b00ea..d55c328736 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -2211,3 +2211,21 @@ void blk_unregister_buf(BlockBackend *blk, void *host)
{
bdrv_unregister_buf(blk_bs(blk), host);
}
+
+int coroutine_fn blk_co_copy_range(BlockBackend *blk_in, int64_t off_in,
+ BlockBackend *blk_out, int64_t off_out,
+ int bytes, BdrvRequestFlags flags)
+{
+ int r;
+ r = blk_check_byte_request(blk_in, off_in, bytes);
+ if (r) {
+ return r;
+ }
+ r = blk_check_byte_request(blk_out, off_out, bytes);
+ if (r) {
+ return r;
+ }
+ return bdrv_co_copy_range(blk_in->root, off_in,
+ blk_out->root, off_out,
+ bytes, flags);
+}