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

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