|
|
357786 |
From 6f8e77a19dc072d428624f521e35a82a80893d25 Mon Sep 17 00:00:00 2001
|
|
|
357786 |
From: Fam Zheng <famz@redhat.com>
|
|
|
357786 |
Date: Fri, 29 Jun 2018 06:11:49 +0200
|
|
|
357786 |
Subject: [PATCH 45/57] block-backend: Add blk_co_copy_range
|
|
|
357786 |
|
|
|
357786 |
RH-Author: Fam Zheng <famz@redhat.com>
|
|
|
357786 |
Message-id: <20180629061153.12687-10-famz@redhat.com>
|
|
|
357786 |
Patchwork-id: 81161
|
|
|
357786 |
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH v2 09/13] block-backend: Add blk_co_copy_range
|
|
|
357786 |
Bugzilla: 1482537
|
|
|
357786 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
357786 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
357786 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
357786 |
|
|
|
357786 |
It's a BlockBackend wrapper of the BDS interface.
|
|
|
357786 |
|
|
|
357786 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
357786 |
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
357786 |
Message-id: 20180601092648.24614-10-famz@redhat.com
|
|
|
357786 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
357786 |
(cherry picked from commit b5679fa49c9a70efa7bf01f6efad1a65e2349a0b)
|
|
|
357786 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
357786 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
357786 |
---
|
|
|
357786 |
block/block-backend.c | 18 ++++++++++++++++++
|
|
|
357786 |
include/sysemu/block-backend.h | 4 ++++
|
|
|
357786 |
2 files changed, 22 insertions(+)
|
|
|
357786 |
|
|
|
357786 |
diff --git a/block/block-backend.c b/block/block-backend.c
|
|
|
357786 |
index fd342db..56ae535 100644
|
|
|
357786 |
--- a/block/block-backend.c
|
|
|
357786 |
+++ b/block/block-backend.c
|
|
|
357786 |
@@ -2236,3 +2236,21 @@ void blk_unregister_buf(BlockBackend *blk, void *host)
|
|
|
357786 |
{
|
|
|
357786 |
bdrv_unregister_buf(blk_bs(blk), host);
|
|
|
357786 |
}
|
|
|
357786 |
+
|
|
|
357786 |
+int coroutine_fn blk_co_copy_range(BlockBackend *blk_in, int64_t off_in,
|
|
|
357786 |
+ BlockBackend *blk_out, int64_t off_out,
|
|
|
357786 |
+ int bytes, BdrvRequestFlags flags)
|
|
|
357786 |
+{
|
|
|
357786 |
+ int r;
|
|
|
357786 |
+ r = blk_check_byte_request(blk_in, off_in, bytes);
|
|
|
357786 |
+ if (r) {
|
|
|
357786 |
+ return r;
|
|
|
357786 |
+ }
|
|
|
357786 |
+ r = blk_check_byte_request(blk_out, off_out, bytes);
|
|
|
357786 |
+ if (r) {
|
|
|
357786 |
+ return r;
|
|
|
357786 |
+ }
|
|
|
357786 |
+ return bdrv_co_copy_range(blk_in->root, off_in,
|
|
|
357786 |
+ blk_out->root, off_out,
|
|
|
357786 |
+ bytes, flags);
|
|
|
357786 |
+}
|
|
|
357786 |
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
|
|
|
357786 |
index 92ab624..8d03d49 100644
|
|
|
357786 |
--- a/include/sysemu/block-backend.h
|
|
|
357786 |
+++ b/include/sysemu/block-backend.h
|
|
|
357786 |
@@ -232,4 +232,8 @@ void blk_set_force_allow_inactivate(BlockBackend *blk);
|
|
|
357786 |
void blk_register_buf(BlockBackend *blk, void *host, size_t size);
|
|
|
357786 |
void blk_unregister_buf(BlockBackend *blk, void *host);
|
|
|
357786 |
|
|
|
357786 |
+int coroutine_fn blk_co_copy_range(BlockBackend *blk_in, int64_t off_in,
|
|
|
357786 |
+ BlockBackend *blk_out, int64_t off_out,
|
|
|
357786 |
+ int bytes, BdrvRequestFlags flags);
|
|
|
357786 |
+
|
|
|
357786 |
#endif
|
|
|
357786 |
--
|
|
|
357786 |
1.8.3.1
|
|
|
357786 |
|