|
|
26ba25 |
From 3995a70bd22fb0d3d7fe8edb692d2c03794a779f Mon Sep 17 00:00:00 2001
|
|
|
26ba25 |
From: Fam Zheng <famz@redhat.com>
|
|
|
26ba25 |
Date: Fri, 29 Jun 2018 06:11:43 +0200
|
|
|
26ba25 |
Subject: [PATCH 169/268] raw: Implement copy offloading
|
|
|
26ba25 |
|
|
|
26ba25 |
RH-Author: Fam Zheng <famz@redhat.com>
|
|
|
26ba25 |
Message-id: <20180629061153.12687-4-famz@redhat.com>
|
|
|
26ba25 |
Patchwork-id: 81155
|
|
|
26ba25 |
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH v2 03/13] raw: Implement copy offloading
|
|
|
26ba25 |
Bugzilla: 1482537
|
|
|
26ba25 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
26ba25 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
26ba25 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
26ba25 |
|
|
|
26ba25 |
Just pass down to ->file.
|
|
|
26ba25 |
|
|
|
26ba25 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
26ba25 |
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
26ba25 |
Message-id: 20180601092648.24614-4-famz@redhat.com
|
|
|
26ba25 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
26ba25 |
(cherry picked from commit 72d219e2f916adeec9845473d239571a267f3314)
|
|
|
26ba25 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
26ba25 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
26ba25 |
---
|
|
|
26ba25 |
block/raw-format.c | 32 ++++++++++++++++++++++++++++++++
|
|
|
26ba25 |
1 file changed, 32 insertions(+)
|
|
|
26ba25 |
|
|
|
26ba25 |
diff --git a/block/raw-format.c b/block/raw-format.c
|
|
|
26ba25 |
index b69a067..f2e468d 100644
|
|
|
26ba25 |
--- a/block/raw-format.c
|
|
|
26ba25 |
+++ b/block/raw-format.c
|
|
|
26ba25 |
@@ -497,6 +497,36 @@ static int raw_probe_geometry(BlockDriverState *bs, HDGeometry *geo)
|
|
|
26ba25 |
return bdrv_probe_geometry(bs->file->bs, geo);
|
|
|
26ba25 |
}
|
|
|
26ba25 |
|
|
|
26ba25 |
+static int coroutine_fn raw_co_copy_range_from(BlockDriverState *bs,
|
|
|
26ba25 |
+ BdrvChild *src, uint64_t src_offset,
|
|
|
26ba25 |
+ BdrvChild *dst, uint64_t dst_offset,
|
|
|
26ba25 |
+ uint64_t bytes, BdrvRequestFlags flags)
|
|
|
26ba25 |
+{
|
|
|
26ba25 |
+ int ret;
|
|
|
26ba25 |
+
|
|
|
26ba25 |
+ ret = raw_adjust_offset(bs, &src_offset, bytes, false);
|
|
|
26ba25 |
+ if (ret) {
|
|
|
26ba25 |
+ return ret;
|
|
|
26ba25 |
+ }
|
|
|
26ba25 |
+ return bdrv_co_copy_range_from(bs->file, src_offset, dst, dst_offset,
|
|
|
26ba25 |
+ bytes, flags);
|
|
|
26ba25 |
+}
|
|
|
26ba25 |
+
|
|
|
26ba25 |
+static int coroutine_fn raw_co_copy_range_to(BlockDriverState *bs,
|
|
|
26ba25 |
+ BdrvChild *src, uint64_t src_offset,
|
|
|
26ba25 |
+ BdrvChild *dst, uint64_t dst_offset,
|
|
|
26ba25 |
+ uint64_t bytes, BdrvRequestFlags flags)
|
|
|
26ba25 |
+{
|
|
|
26ba25 |
+ int ret;
|
|
|
26ba25 |
+
|
|
|
26ba25 |
+ ret = raw_adjust_offset(bs, &dst_offset, bytes, true);
|
|
|
26ba25 |
+ if (ret) {
|
|
|
26ba25 |
+ return ret;
|
|
|
26ba25 |
+ }
|
|
|
26ba25 |
+ return bdrv_co_copy_range_to(src, src_offset, bs->file, dst_offset, bytes,
|
|
|
26ba25 |
+ flags);
|
|
|
26ba25 |
+}
|
|
|
26ba25 |
+
|
|
|
26ba25 |
BlockDriver bdrv_raw = {
|
|
|
26ba25 |
.format_name = "raw",
|
|
|
26ba25 |
.instance_size = sizeof(BDRVRawState),
|
|
|
26ba25 |
@@ -513,6 +543,8 @@ BlockDriver bdrv_raw = {
|
|
|
26ba25 |
.bdrv_co_pwrite_zeroes = &raw_co_pwrite_zeroes,
|
|
|
26ba25 |
.bdrv_co_pdiscard = &raw_co_pdiscard,
|
|
|
26ba25 |
.bdrv_co_block_status = &raw_co_block_status,
|
|
|
26ba25 |
+ .bdrv_co_copy_range_from = &raw_co_copy_range_from,
|
|
|
26ba25 |
+ .bdrv_co_copy_range_to = &raw_co_copy_range_to,
|
|
|
26ba25 |
.bdrv_truncate = &raw_truncate,
|
|
|
26ba25 |
.bdrv_getlength = &raw_getlength,
|
|
|
26ba25 |
.has_variable_length = true,
|
|
|
26ba25 |
--
|
|
|
26ba25 |
1.8.3.1
|
|
|
26ba25 |
|