Blame SOURCES/kvm-raw-Implement-copy-offloading.patch

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