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