yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
ae23c9
From fa82fe1be0413e2dbc453aa5a2a930218e915907 Mon Sep 17 00:00:00 2001
ae23c9
From: John Snow <jsnow@redhat.com>
ae23c9
Date: Tue, 24 Jul 2018 13:01:08 +0200
ae23c9
Subject: [PATCH 238/268] block: split flags in copy_range
ae23c9
ae23c9
RH-Author: John Snow <jsnow@redhat.com>
ae23c9
Message-id: <20180718225511.14878-21-jsnow@redhat.com>
ae23c9
Patchwork-id: 81415
ae23c9
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 20/35] block: split flags in copy_range
ae23c9
Bugzilla: 1207657
ae23c9
RH-Acked-by: Eric Blake <eblake@redhat.com>
ae23c9
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
ae23c9
RH-Acked-by: Fam Zheng <famz@redhat.com>
ae23c9
ae23c9
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
ae23c9
ae23c9
Pass read flags and write flags separately. This is needed to handle
ae23c9
coming BDRV_REQ_NO_SERIALISING clearly in following patches.
ae23c9
ae23c9
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
ae23c9
Reviewed-by: Fam Zheng <famz@redhat.com>
ae23c9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ae23c9
(cherry picked from commit 67b51fb998c697afb5d744066fcbde53e04fe941)
ae23c9
Signed-off-by: John Snow <jsnow@redhat.com>
ae23c9
---
ae23c9
 block/backup.c                 |  2 +-
ae23c9
 block/block-backend.c          |  5 +++--
ae23c9
 block/file-posix.c             | 21 +++++++++++--------
ae23c9
 block/io.c                     | 46 +++++++++++++++++++++++-------------------
ae23c9
 block/iscsi.c                  |  9 ++++++---
ae23c9
 block/qcow2.c                  | 20 +++++++++---------
ae23c9
 block/raw-format.c             | 24 ++++++++++++++--------
ae23c9
 include/block/block.h          |  3 ++-
ae23c9
 include/block/block_int.h      | 14 +++++++++----
ae23c9
 include/sysemu/block-backend.h |  3 ++-
ae23c9
 qemu-img.c                     |  2 +-
ae23c9
 11 files changed, 90 insertions(+), 59 deletions(-)
ae23c9
ae23c9
diff --git a/block/backup.c b/block/backup.c
ae23c9
index adb3cbd..369155a 100644
ae23c9
--- a/block/backup.c
ae23c9
+++ b/block/backup.c
ae23c9
@@ -163,7 +163,7 @@ static int coroutine_fn backup_cow_with_offload(BackupBlockJob *job,
ae23c9
     hbitmap_reset(job->copy_bitmap, start / job->cluster_size,
ae23c9
                   nr_clusters);
ae23c9
     ret = blk_co_copy_range(blk, start, job->target, start, nbytes,
ae23c9
-                            is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0);
ae23c9
+                            is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0, 0);
ae23c9
     if (ret < 0) {
ae23c9
         trace_backup_do_cow_copy_range_fail(job, start, ret);
ae23c9
         hbitmap_set(job->copy_bitmap, start / job->cluster_size,
ae23c9
diff --git a/block/block-backend.c b/block/block-backend.c
ae23c9
index f34e4c3..3554b7e 100644
ae23c9
--- a/block/block-backend.c
ae23c9
+++ b/block/block-backend.c
ae23c9
@@ -2225,7 +2225,8 @@ void blk_unregister_buf(BlockBackend *blk, void *host)
ae23c9
 
ae23c9
 int coroutine_fn blk_co_copy_range(BlockBackend *blk_in, int64_t off_in,
ae23c9
                                    BlockBackend *blk_out, int64_t off_out,
ae23c9
-                                   int bytes, BdrvRequestFlags flags)
ae23c9
+                                   int bytes, BdrvRequestFlags read_flags,
ae23c9
+                                   BdrvRequestFlags write_flags)
ae23c9
 {
ae23c9
     int r;
ae23c9
     r = blk_check_byte_request(blk_in, off_in, bytes);
ae23c9
@@ -2238,5 +2239,5 @@ int coroutine_fn blk_co_copy_range(BlockBackend *blk_in, int64_t off_in,
ae23c9
     }
ae23c9
     return bdrv_co_copy_range(blk_in->root, off_in,
ae23c9
                               blk_out->root, off_out,
ae23c9
-                              bytes, flags);
ae23c9
+                              bytes, read_flags, write_flags);
ae23c9
 }
ae23c9
diff --git a/block/file-posix.c b/block/file-posix.c
ae23c9
index 06ec67d..c12cdb7 100644
ae23c9
--- a/block/file-posix.c
ae23c9
+++ b/block/file-posix.c
ae23c9
@@ -2476,18 +2476,23 @@ static void raw_abort_perm_update(BlockDriverState *bs)
ae23c9
     raw_handle_perm_lock(bs, RAW_PL_ABORT, 0, 0, NULL);
ae23c9
 }
ae23c9
 
ae23c9
-static int coroutine_fn raw_co_copy_range_from(BlockDriverState *bs,
ae23c9
-                                               BdrvChild *src, uint64_t src_offset,
ae23c9
-                                               BdrvChild *dst, uint64_t dst_offset,
ae23c9
-                                               uint64_t bytes, BdrvRequestFlags flags)
ae23c9
+static int coroutine_fn raw_co_copy_range_from(
ae23c9
+        BlockDriverState *bs, BdrvChild *src, uint64_t src_offset,
ae23c9
+        BdrvChild *dst, uint64_t dst_offset, uint64_t bytes,
ae23c9
+        BdrvRequestFlags read_flags, BdrvRequestFlags write_flags)
ae23c9
 {
ae23c9
-    return bdrv_co_copy_range_to(src, src_offset, dst, dst_offset, bytes, flags);
ae23c9
+    return bdrv_co_copy_range_to(src, src_offset, dst, dst_offset, bytes,
ae23c9
+                                 read_flags, write_flags);
ae23c9
 }
ae23c9
 
ae23c9
 static int coroutine_fn raw_co_copy_range_to(BlockDriverState *bs,
ae23c9
-                                             BdrvChild *src, uint64_t src_offset,
ae23c9
-                                             BdrvChild *dst, uint64_t dst_offset,
ae23c9
-                                             uint64_t bytes, BdrvRequestFlags flags)
ae23c9
+                                             BdrvChild *src,
ae23c9
+                                             uint64_t src_offset,
ae23c9
+                                             BdrvChild *dst,
ae23c9
+                                             uint64_t dst_offset,
ae23c9
+                                             uint64_t bytes,
ae23c9
+                                             BdrvRequestFlags read_flags,
ae23c9
+                                             BdrvRequestFlags write_flags)
ae23c9
 {
ae23c9
     BDRVRawState *s = bs->opaque;
ae23c9
     BDRVRawState *src_s;
ae23c9
diff --git a/block/io.c b/block/io.c
ae23c9
index f8de42f..2d04289 100644
ae23c9
--- a/block/io.c
ae23c9
+++ b/block/io.c
ae23c9
@@ -2841,13 +2841,11 @@ void bdrv_unregister_buf(BlockDriverState *bs, void *host)
ae23c9
     }
ae23c9
 }
ae23c9
 
ae23c9
-static int coroutine_fn bdrv_co_copy_range_internal(BdrvChild *src,
ae23c9
-                                                    uint64_t src_offset,
ae23c9
-                                                    BdrvChild *dst,
ae23c9
-                                                    uint64_t dst_offset,
ae23c9
-                                                    uint64_t bytes,
ae23c9
-                                                    BdrvRequestFlags flags,
ae23c9
-                                                    bool recurse_src)
ae23c9
+static int coroutine_fn bdrv_co_copy_range_internal(
ae23c9
+        BdrvChild *src, uint64_t src_offset, BdrvChild *dst,
ae23c9
+        uint64_t dst_offset, uint64_t bytes,
ae23c9
+        BdrvRequestFlags read_flags, BdrvRequestFlags write_flags,
ae23c9
+        bool recurse_src)
ae23c9
 {
ae23c9
     BdrvTrackedRequest req;
ae23c9
     int ret;
ae23c9
@@ -2860,8 +2858,8 @@ static int coroutine_fn bdrv_co_copy_range_internal(BdrvChild *src,
ae23c9
     if (ret) {
ae23c9
         return ret;
ae23c9
     }
ae23c9
-    if (flags & BDRV_REQ_ZERO_WRITE) {
ae23c9
-        return bdrv_co_pwrite_zeroes(dst, dst_offset, bytes, flags);
ae23c9
+    if (write_flags & BDRV_REQ_ZERO_WRITE) {
ae23c9
+        return bdrv_co_pwrite_zeroes(dst, dst_offset, bytes, write_flags);
ae23c9
     }
ae23c9
 
ae23c9
     if (!src || !src->bs) {
ae23c9
@@ -2883,14 +2881,15 @@ static int coroutine_fn bdrv_co_copy_range_internal(BdrvChild *src,
ae23c9
         tracked_request_begin(&req, src->bs, src_offset, bytes,
ae23c9
                               BDRV_TRACKED_READ);
ae23c9
 
ae23c9
-        if (!(flags & BDRV_REQ_NO_SERIALISING)) {
ae23c9
+        if (!(read_flags & BDRV_REQ_NO_SERIALISING)) {
ae23c9
             wait_serialising_requests(&req;;
ae23c9
         }
ae23c9
 
ae23c9
         ret = src->bs->drv->bdrv_co_copy_range_from(src->bs,
ae23c9
                                                     src, src_offset,
ae23c9
                                                     dst, dst_offset,
ae23c9
-                                                    bytes, flags);
ae23c9
+                                                    bytes,
ae23c9
+                                                    read_flags, write_flags);
ae23c9
 
ae23c9
         tracked_request_end(&req;;
ae23c9
         bdrv_dec_in_flight(src->bs);
ae23c9
@@ -2899,15 +2898,15 @@ static int coroutine_fn bdrv_co_copy_range_internal(BdrvChild *src,
ae23c9
         tracked_request_begin(&req, dst->bs, dst_offset, bytes,
ae23c9
                               BDRV_TRACKED_WRITE);
ae23c9
 
ae23c9
-        /* BDRV_REQ_NO_SERIALISING is only for read operation,
ae23c9
-         * so we ignore it in flags.
ae23c9
-         */
ae23c9
+        /* BDRV_REQ_NO_SERIALISING is only for read operation */
ae23c9
+        assert(!(write_flags & BDRV_REQ_NO_SERIALISING));
ae23c9
         wait_serialising_requests(&req;;
ae23c9
 
ae23c9
         ret = dst->bs->drv->bdrv_co_copy_range_to(dst->bs,
ae23c9
                                                   src, src_offset,
ae23c9
                                                   dst, dst_offset,
ae23c9
-                                                  bytes, flags);
ae23c9
+                                                  bytes,
ae23c9
+                                                  read_flags, write_flags);
ae23c9
 
ae23c9
         tracked_request_end(&req;;
ae23c9
         bdrv_dec_in_flight(dst->bs);
ae23c9
@@ -2922,10 +2921,12 @@ static int coroutine_fn bdrv_co_copy_range_internal(BdrvChild *src,
ae23c9
  * semantics. */
ae23c9
 int coroutine_fn bdrv_co_copy_range_from(BdrvChild *src, uint64_t src_offset,
ae23c9
                                          BdrvChild *dst, uint64_t dst_offset,
ae23c9
-                                         uint64_t bytes, BdrvRequestFlags flags)
ae23c9
+                                         uint64_t bytes,
ae23c9
+                                         BdrvRequestFlags read_flags,
ae23c9
+                                         BdrvRequestFlags write_flags)
ae23c9
 {
ae23c9
     return bdrv_co_copy_range_internal(src, src_offset, dst, dst_offset,
ae23c9
-                                       bytes, flags, true);
ae23c9
+                                       bytes, read_flags, write_flags, true);
ae23c9
 }
ae23c9
 
ae23c9
 /* Copy range from @src to @dst.
ae23c9
@@ -2934,19 +2935,22 @@ int coroutine_fn bdrv_co_copy_range_from(BdrvChild *src, uint64_t src_offset,
ae23c9
  * semantics. */
ae23c9
 int coroutine_fn bdrv_co_copy_range_to(BdrvChild *src, uint64_t src_offset,
ae23c9
                                        BdrvChild *dst, uint64_t dst_offset,
ae23c9
-                                       uint64_t bytes, BdrvRequestFlags flags)
ae23c9
+                                       uint64_t bytes,
ae23c9
+                                       BdrvRequestFlags read_flags,
ae23c9
+                                       BdrvRequestFlags write_flags)
ae23c9
 {
ae23c9
     return bdrv_co_copy_range_internal(src, src_offset, dst, dst_offset,
ae23c9
-                                       bytes, flags, false);
ae23c9
+                                       bytes, read_flags, write_flags, false);
ae23c9
 }
ae23c9
 
ae23c9
 int coroutine_fn bdrv_co_copy_range(BdrvChild *src, uint64_t src_offset,
ae23c9
                                     BdrvChild *dst, uint64_t dst_offset,
ae23c9
-                                    uint64_t bytes, BdrvRequestFlags flags)
ae23c9
+                                    uint64_t bytes, BdrvRequestFlags read_flags,
ae23c9
+                                    BdrvRequestFlags write_flags)
ae23c9
 {
ae23c9
     return bdrv_co_copy_range_from(src, src_offset,
ae23c9
                                    dst, dst_offset,
ae23c9
-                                   bytes, flags);
ae23c9
+                                   bytes, read_flags, write_flags);
ae23c9
 }
ae23c9
 
ae23c9
 static void bdrv_parent_cb_resize(BlockDriverState *bs)
ae23c9
diff --git a/block/iscsi.c b/block/iscsi.c
ae23c9
index 5047e83..2b45458 100644
ae23c9
--- a/block/iscsi.c
ae23c9
+++ b/block/iscsi.c
ae23c9
@@ -2193,9 +2193,11 @@ static int coroutine_fn iscsi_co_copy_range_from(BlockDriverState *bs,
ae23c9
                                                  BdrvChild *dst,
ae23c9
                                                  uint64_t dst_offset,
ae23c9
                                                  uint64_t bytes,
ae23c9
-                                                 BdrvRequestFlags flags)
ae23c9
+                                                 BdrvRequestFlags read_flags,
ae23c9
+                                                 BdrvRequestFlags write_flags)
ae23c9
 {
ae23c9
-    return bdrv_co_copy_range_to(src, src_offset, dst, dst_offset, bytes, flags);
ae23c9
+    return bdrv_co_copy_range_to(src, src_offset, dst, dst_offset, bytes,
ae23c9
+                                 read_flags, write_flags);
ae23c9
 }
ae23c9
 
ae23c9
 static struct scsi_task *iscsi_xcopy_task(int param_len)
ae23c9
@@ -2332,7 +2334,8 @@ static int coroutine_fn iscsi_co_copy_range_to(BlockDriverState *bs,
ae23c9
                                                BdrvChild *dst,
ae23c9
                                                uint64_t dst_offset,
ae23c9
                                                uint64_t bytes,
ae23c9
-                                               BdrvRequestFlags flags)
ae23c9
+                                               BdrvRequestFlags read_flags,
ae23c9
+                                               BdrvRequestFlags write_flags)
ae23c9
 {
ae23c9
     IscsiLun *dst_lun = dst->bs->opaque;
ae23c9
     IscsiLun *src_lun;
ae23c9
diff --git a/block/qcow2.c b/block/qcow2.c
ae23c9
index e171a99..1ea7203 100644
ae23c9
--- a/block/qcow2.c
ae23c9
+++ b/block/qcow2.c
ae23c9
@@ -3248,13 +3248,14 @@ static int coroutine_fn
ae23c9
 qcow2_co_copy_range_from(BlockDriverState *bs,
ae23c9
                          BdrvChild *src, uint64_t src_offset,
ae23c9
                          BdrvChild *dst, uint64_t dst_offset,
ae23c9
-                         uint64_t bytes, BdrvRequestFlags flags)
ae23c9
+                         uint64_t bytes, BdrvRequestFlags read_flags,
ae23c9
+                         BdrvRequestFlags write_flags)
ae23c9
 {
ae23c9
     BDRVQcow2State *s = bs->opaque;
ae23c9
     int ret;
ae23c9
     unsigned int cur_bytes; /* number of bytes in current iteration */
ae23c9
     BdrvChild *child = NULL;
ae23c9
-    BdrvRequestFlags cur_flags;
ae23c9
+    BdrvRequestFlags cur_write_flags;
ae23c9
 
ae23c9
     assert(!bs->encrypted);
ae23c9
     qemu_co_mutex_lock(&s->lock);
ae23c9
@@ -3263,7 +3264,7 @@ qcow2_co_copy_range_from(BlockDriverState *bs,
ae23c9
         uint64_t copy_offset = 0;
ae23c9
         /* prepare next request */
ae23c9
         cur_bytes = MIN(bytes, INT_MAX);
ae23c9
-        cur_flags = flags;
ae23c9
+        cur_write_flags = write_flags;
ae23c9
 
ae23c9
         ret = qcow2_get_cluster_offset(bs, src_offset, &cur_bytes, &copy_offset);
ae23c9
         if (ret < 0) {
ae23c9
@@ -3275,20 +3276,20 @@ qcow2_co_copy_range_from(BlockDriverState *bs,
ae23c9
             if (bs->backing && bs->backing->bs) {
ae23c9
                 int64_t backing_length = bdrv_getlength(bs->backing->bs);
ae23c9
                 if (src_offset >= backing_length) {
ae23c9
-                    cur_flags |= BDRV_REQ_ZERO_WRITE;
ae23c9
+                    cur_write_flags |= BDRV_REQ_ZERO_WRITE;
ae23c9
                 } else {
ae23c9
                     child = bs->backing;
ae23c9
                     cur_bytes = MIN(cur_bytes, backing_length - src_offset);
ae23c9
                     copy_offset = src_offset;
ae23c9
                 }
ae23c9
             } else {
ae23c9
-                cur_flags |= BDRV_REQ_ZERO_WRITE;
ae23c9
+                cur_write_flags |= BDRV_REQ_ZERO_WRITE;
ae23c9
             }
ae23c9
             break;
ae23c9
 
ae23c9
         case QCOW2_CLUSTER_ZERO_PLAIN:
ae23c9
         case QCOW2_CLUSTER_ZERO_ALLOC:
ae23c9
-            cur_flags |= BDRV_REQ_ZERO_WRITE;
ae23c9
+            cur_write_flags |= BDRV_REQ_ZERO_WRITE;
ae23c9
             break;
ae23c9
 
ae23c9
         case QCOW2_CLUSTER_COMPRESSED:
ae23c9
@@ -3312,7 +3313,7 @@ qcow2_co_copy_range_from(BlockDriverState *bs,
ae23c9
         ret = bdrv_co_copy_range_from(child,
ae23c9
                                       copy_offset,
ae23c9
                                       dst, dst_offset,
ae23c9
-                                      cur_bytes, cur_flags);
ae23c9
+                                      cur_bytes, read_flags, cur_write_flags);
ae23c9
         qemu_co_mutex_lock(&s->lock);
ae23c9
         if (ret < 0) {
ae23c9
             goto out;
ae23c9
@@ -3333,7 +3334,8 @@ static int coroutine_fn
ae23c9
 qcow2_co_copy_range_to(BlockDriverState *bs,
ae23c9
                        BdrvChild *src, uint64_t src_offset,
ae23c9
                        BdrvChild *dst, uint64_t dst_offset,
ae23c9
-                       uint64_t bytes, BdrvRequestFlags flags)
ae23c9
+                       uint64_t bytes, BdrvRequestFlags read_flags,
ae23c9
+                       BdrvRequestFlags write_flags)
ae23c9
 {
ae23c9
     BDRVQcow2State *s = bs->opaque;
ae23c9
     int offset_in_cluster;
ae23c9
@@ -3377,7 +3379,7 @@ qcow2_co_copy_range_to(BlockDriverState *bs,
ae23c9
         ret = bdrv_co_copy_range_to(src, src_offset,
ae23c9
                                     bs->file,
ae23c9
                                     cluster_offset + offset_in_cluster,
ae23c9
-                                    cur_bytes, flags);
ae23c9
+                                    cur_bytes, read_flags, write_flags);
ae23c9
         qemu_co_mutex_lock(&s->lock);
ae23c9
         if (ret < 0) {
ae23c9
             goto fail;
ae23c9
diff --git a/block/raw-format.c b/block/raw-format.c
ae23c9
index b78da56..a359198 100644
ae23c9
--- a/block/raw-format.c
ae23c9
+++ b/block/raw-format.c
ae23c9
@@ -498,9 +498,13 @@ static int raw_probe_geometry(BlockDriverState *bs, HDGeometry *geo)
ae23c9
 }
ae23c9
 
ae23c9
 static int coroutine_fn raw_co_copy_range_from(BlockDriverState *bs,
ae23c9
-                                               BdrvChild *src, uint64_t src_offset,
ae23c9
-                                               BdrvChild *dst, uint64_t dst_offset,
ae23c9
-                                               uint64_t bytes, BdrvRequestFlags flags)
ae23c9
+                                               BdrvChild *src,
ae23c9
+                                               uint64_t src_offset,
ae23c9
+                                               BdrvChild *dst,
ae23c9
+                                               uint64_t dst_offset,
ae23c9
+                                               uint64_t bytes,
ae23c9
+                                               BdrvRequestFlags read_flags,
ae23c9
+                                               BdrvRequestFlags write_flags)
ae23c9
 {
ae23c9
     int ret;
ae23c9
 
ae23c9
@@ -509,13 +513,17 @@ static int coroutine_fn raw_co_copy_range_from(BlockDriverState *bs,
ae23c9
         return ret;
ae23c9
     }
ae23c9
     return bdrv_co_copy_range_from(bs->file, src_offset, dst, dst_offset,
ae23c9
-                                   bytes, flags);
ae23c9
+                                   bytes, read_flags, write_flags);
ae23c9
 }
ae23c9
 
ae23c9
 static int coroutine_fn raw_co_copy_range_to(BlockDriverState *bs,
ae23c9
-                                             BdrvChild *src, uint64_t src_offset,
ae23c9
-                                             BdrvChild *dst, uint64_t dst_offset,
ae23c9
-                                             uint64_t bytes, BdrvRequestFlags flags)
ae23c9
+                                             BdrvChild *src,
ae23c9
+                                             uint64_t src_offset,
ae23c9
+                                             BdrvChild *dst,
ae23c9
+                                             uint64_t dst_offset,
ae23c9
+                                             uint64_t bytes,
ae23c9
+                                             BdrvRequestFlags read_flags,
ae23c9
+                                             BdrvRequestFlags write_flags)
ae23c9
 {
ae23c9
     int ret;
ae23c9
 
ae23c9
@@ -524,7 +532,7 @@ static int coroutine_fn raw_co_copy_range_to(BlockDriverState *bs,
ae23c9
         return ret;
ae23c9
     }
ae23c9
     return bdrv_co_copy_range_to(src, src_offset, bs->file, dst_offset, bytes,
ae23c9
-                                 flags);
ae23c9
+                                 read_flags, write_flags);
ae23c9
 }
ae23c9
 
ae23c9
 BlockDriver bdrv_raw = {
ae23c9
diff --git a/include/block/block.h b/include/block/block.h
ae23c9
index 716fb5b..409db21 100644
ae23c9
--- a/include/block/block.h
ae23c9
+++ b/include/block/block.h
ae23c9
@@ -661,5 +661,6 @@ void bdrv_unregister_buf(BlockDriverState *bs, void *host);
ae23c9
  **/
ae23c9
 int coroutine_fn bdrv_co_copy_range(BdrvChild *src, uint64_t src_offset,
ae23c9
                                     BdrvChild *dst, uint64_t dst_offset,
ae23c9
-                                    uint64_t bytes, BdrvRequestFlags flags);
ae23c9
+                                    uint64_t bytes, BdrvRequestFlags read_flags,
ae23c9
+                                    BdrvRequestFlags write_flags);
ae23c9
 #endif
ae23c9
diff --git a/include/block/block_int.h b/include/block/block_int.h
ae23c9
index 27e168f..b05cf11 100644
ae23c9
--- a/include/block/block_int.h
ae23c9
+++ b/include/block/block_int.h
ae23c9
@@ -220,7 +220,8 @@ struct BlockDriver {
ae23c9
                                                 BdrvChild *dst,
ae23c9
                                                 uint64_t dst_offset,
ae23c9
                                                 uint64_t bytes,
ae23c9
-                                                BdrvRequestFlags flags);
ae23c9
+                                                BdrvRequestFlags read_flags,
ae23c9
+                                                BdrvRequestFlags write_flags);
ae23c9
 
ae23c9
     /* Map [offset, offset + nbytes) range onto a child of bs to copy data to,
ae23c9
      * and invoke bdrv_co_copy_range_to(child, src, ...), or perform the copy
ae23c9
@@ -236,7 +237,8 @@ struct BlockDriver {
ae23c9
                                               BdrvChild *dst,
ae23c9
                                               uint64_t dst_offset,
ae23c9
                                               uint64_t bytes,
ae23c9
-                                              BdrvRequestFlags flags);
ae23c9
+                                              BdrvRequestFlags read_flags,
ae23c9
+                                              BdrvRequestFlags write_flags);
ae23c9
 
ae23c9
     /*
ae23c9
      * Building block for bdrv_block_status[_above] and
ae23c9
@@ -1125,10 +1127,14 @@ void blockdev_close_all_bdrv_states(void);
ae23c9
 
ae23c9
 int coroutine_fn bdrv_co_copy_range_from(BdrvChild *src, uint64_t src_offset,
ae23c9
                                          BdrvChild *dst, uint64_t dst_offset,
ae23c9
-                                         uint64_t bytes, BdrvRequestFlags flags);
ae23c9
+                                         uint64_t bytes,
ae23c9
+                                         BdrvRequestFlags read_flags,
ae23c9
+                                         BdrvRequestFlags write_flags);
ae23c9
 int coroutine_fn bdrv_co_copy_range_to(BdrvChild *src, uint64_t src_offset,
ae23c9
                                        BdrvChild *dst, uint64_t dst_offset,
ae23c9
-                                       uint64_t bytes, BdrvRequestFlags flags);
ae23c9
+                                       uint64_t bytes,
ae23c9
+                                       BdrvRequestFlags read_flags,
ae23c9
+                                       BdrvRequestFlags write_flags);
ae23c9
 
ae23c9
 int refresh_total_sectors(BlockDriverState *bs, int64_t hint);
ae23c9
 
ae23c9
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
ae23c9
index 8d03d49..830d873 100644
ae23c9
--- a/include/sysemu/block-backend.h
ae23c9
+++ b/include/sysemu/block-backend.h
ae23c9
@@ -234,6 +234,7 @@ void blk_unregister_buf(BlockBackend *blk, void *host);
ae23c9
 
ae23c9
 int coroutine_fn blk_co_copy_range(BlockBackend *blk_in, int64_t off_in,
ae23c9
                                    BlockBackend *blk_out, int64_t off_out,
ae23c9
-                                   int bytes, BdrvRequestFlags flags);
ae23c9
+                                   int bytes, BdrvRequestFlags read_flags,
ae23c9
+                                   BdrvRequestFlags write_flags);
ae23c9
 
ae23c9
 #endif
ae23c9
diff --git a/qemu-img.c b/qemu-img.c
ae23c9
index b2ef54e..eaee6d6 100644
ae23c9
--- a/qemu-img.c
ae23c9
+++ b/qemu-img.c
ae23c9
@@ -1786,7 +1786,7 @@ static int coroutine_fn convert_co_copy_range(ImgConvertState *s, int64_t sector
ae23c9
 
ae23c9
         ret = blk_co_copy_range(blk, offset, s->target,
ae23c9
                                 sector_num << BDRV_SECTOR_BITS,
ae23c9
-                                n << BDRV_SECTOR_BITS, 0);
ae23c9
+                                n << BDRV_SECTOR_BITS, 0, 0);
ae23c9
         if (ret < 0) {
ae23c9
             return ret;
ae23c9
         }
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9