From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Ronnie Sahlberg <ronniesahlberg@gmail.com>,
qemu-block@nongnu.org, Peter Lieven <pl@kamp.de>,
Fam Zheng <famz@redhat.com>, Kevin Wolf <kwolf@redhat.com>,
Max Reitz <mreitz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
eblake@redhat.com
Subject: [Qemu-devel] [PATCH v7 09/10] block-backend: Add blk_co_copy_range
Date: Tue, 29 May 2018 13:59:58 +0800 [thread overview]
Message-ID: <20180529055959.32002-10-famz@redhat.com> (raw)
In-Reply-To: <20180529055959.32002-1-famz@redhat.com>
It's a BlockBackend wrapper of the BDS interface.
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
block/block-backend.c | 18 ++++++++++++++++++
include/sysemu/block-backend.h | 4 ++++
2 files changed, 22 insertions(+)
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);
+}
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
index 92ab624fac..8d03d493c2 100644
--- a/include/sysemu/block-backend.h
+++ b/include/sysemu/block-backend.h
@@ -232,4 +232,8 @@ void blk_set_force_allow_inactivate(BlockBackend *blk);
void blk_register_buf(BlockBackend *blk, void *host, size_t size);
void blk_unregister_buf(BlockBackend *blk, void *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);
+
#endif
--
2.14.3
next prev parent reply other threads:[~2018-05-29 6:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-29 5:59 [Qemu-devel] [PATCH v7 00/10] qemu-img convert with copy offloading Fam Zheng
2018-05-29 5:59 ` [Qemu-devel] [PATCH v7 01/10] block: Introduce API for " Fam Zheng
2018-05-29 5:59 ` [Qemu-devel] [PATCH v7 02/10] raw: Check byte range uniformly Fam Zheng
2018-05-29 5:59 ` [Qemu-devel] [PATCH v7 03/10] raw: Implement copy offloading Fam Zheng
2018-05-29 5:59 ` [Qemu-devel] [PATCH v7 04/10] qcow2: " Fam Zheng
2018-05-29 5:59 ` [Qemu-devel] [PATCH v7 05/10] file-posix: Implement bdrv_co_copy_range Fam Zheng
2018-05-29 5:59 ` [Qemu-devel] [PATCH v7 06/10] iscsi: Query and save device designator when opening Fam Zheng
2018-05-29 5:59 ` [Qemu-devel] [PATCH v7 07/10] iscsi: Create and use iscsi_co_wait_for_task Fam Zheng
2018-05-29 5:59 ` [Qemu-devel] [PATCH v7 08/10] iscsi: Implement copy offloading Fam Zheng
2018-05-29 5:59 ` Fam Zheng [this message]
2018-05-29 5:59 ` [Qemu-devel] [PATCH v7 10/10] qemu-img: Convert with " Fam Zheng
2018-05-30 16:06 ` [Qemu-devel] [PATCH v7 00/10] qemu-img convert " Stefan Hajnoczi
2018-06-01 2:35 ` Fam Zheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180529055959.32002-10-famz@redhat.com \
--to=famz@redhat.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=pl@kamp.de \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=ronniesahlberg@gmail.com \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).