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

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