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

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