cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-block-Honour-BDRV_REQ_NO_SERIALISING-in-copy-range.patch

26ba25
From 088ddadf21938cfa527bb47ce5452ad502ff2c8d Mon Sep 17 00:00:00 2001
26ba25
From: John Snow <jsnow@redhat.com>
26ba25
Date: Wed, 18 Jul 2018 22:54:51 +0200
26ba25
Subject: [PATCH 233/268] block: Honour BDRV_REQ_NO_SERIALISING in copy range
26ba25
26ba25
RH-Author: John Snow <jsnow@redhat.com>
26ba25
Message-id: <20180718225511.14878-16-jsnow@redhat.com>
26ba25
Patchwork-id: 81402
26ba25
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 15/35] block: Honour BDRV_REQ_NO_SERIALISING in copy range
26ba25
Bugzilla: 1207657
26ba25
RH-Acked-by: Eric Blake <eblake@redhat.com>
26ba25
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
26ba25
RH-Acked-by: Fam Zheng <famz@redhat.com>
26ba25
26ba25
From: Fam Zheng <famz@redhat.com>
26ba25
26ba25
This semantics is needed by drive-backup so implement it before using
26ba25
this API there.
26ba25
26ba25
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
26ba25
Signed-off-by: Fam Zheng <famz@redhat.com>
26ba25
Message-id: 20180703023758.14422-3-famz@redhat.com
26ba25
Signed-off-by: Jeff Cody <jcody@redhat.com>
26ba25
(cherry picked from commit dee12de89380483656072f775f5ef99f4426f966)
26ba25
Signed-off-by: John Snow <jsnow@redhat.com>
26ba25
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
26ba25
---
26ba25
 block/io.c            | 6 ++++--
26ba25
 include/block/block.h | 5 +++--
26ba25
 2 files changed, 7 insertions(+), 4 deletions(-)
26ba25
26ba25
diff --git a/block/io.c b/block/io.c
26ba25
index 7981239..b6754f3 100644
26ba25
--- a/block/io.c
26ba25
+++ b/block/io.c
26ba25
@@ -2883,8 +2883,10 @@ static int coroutine_fn bdrv_co_copy_range_internal(BdrvChild *src,
26ba25
     tracked_request_begin(&dst_req, dst->bs, dst_offset,
26ba25
                           bytes, BDRV_TRACKED_WRITE);
26ba25
 
26ba25
-    wait_serialising_requests(&src_req);
26ba25
-    wait_serialising_requests(&dst_req);
26ba25
+    if (!(flags & BDRV_REQ_NO_SERIALISING)) {
26ba25
+        wait_serialising_requests(&src_req);
26ba25
+        wait_serialising_requests(&dst_req);
26ba25
+    }
26ba25
     if (recurse_src) {
26ba25
         ret = src->bs->drv->bdrv_co_copy_range_from(src->bs,
26ba25
                                                     src, src_offset,
26ba25
diff --git a/include/block/block.h b/include/block/block.h
26ba25
index c3cfb40..e1d5e47 100644
26ba25
--- a/include/block/block.h
26ba25
+++ b/include/block/block.h
26ba25
@@ -636,13 +636,14 @@ void bdrv_unregister_buf(BlockDriverState *bs, void *host);
26ba25
  * @dst: Destination child to copy data to
26ba25
  * @dst_offset: offset in @dst image to write data
26ba25
  * @bytes: number of bytes to copy
26ba25
- * @flags: request flags. Must be one of:
26ba25
- *         0 - actually read data from src;
26ba25
+ * @flags: request flags. Supported flags:
26ba25
  *         BDRV_REQ_ZERO_WRITE - treat the @src range as zero data and do zero
26ba25
  *                               write on @dst as if bdrv_co_pwrite_zeroes is
26ba25
  *                               called. Used to simplify caller code, or
26ba25
  *                               during BlockDriver.bdrv_co_copy_range_from()
26ba25
  *                               recursion.
26ba25
+ *         BDRV_REQ_NO_SERIALISING - do not serialize with other overlapping
26ba25
+ *                                   requests currently in flight.
26ba25
  *
26ba25
  * Returns: 0 if succeeded; negative error code if failed.
26ba25
  **/
26ba25
-- 
26ba25
1.8.3.1
26ba25