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