|
|
1bdc94 |
From fba2d77758d680a147862f26d57bb984d73f7700 Mon Sep 17 00:00:00 2001
|
|
|
1bdc94 |
From: John Snow <jsnow@redhat.com>
|
|
|
1bdc94 |
Date: Tue, 24 Jul 2018 12:43:07 +0200
|
|
|
1bdc94 |
Subject: [PATCH 64/89] block: Move request tracking to children in copy
|
|
|
1bdc94 |
offloading
|
|
|
1bdc94 |
|
|
|
1bdc94 |
RH-Author: John Snow <jsnow@redhat.com>
|
|
|
1bdc94 |
Message-id: <20180718225511.14878-14-jsnow@redhat.com>
|
|
|
1bdc94 |
Patchwork-id: 81393
|
|
|
1bdc94 |
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 13/35] block: Move request tracking to children in copy offloading
|
|
|
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 |
in_flight and tracked requests need to be tracked in every layer during
|
|
|
1bdc94 |
recursion. For now the only user is qemu-img convert where overlapping
|
|
|
1bdc94 |
requests and IOThreads don't exist, therefore this change doesn't make
|
|
|
1bdc94 |
much difference form user point of view, but it is incorrect as part of
|
|
|
1bdc94 |
the API. Fix it.
|
|
|
1bdc94 |
|
|
|
1bdc94 |
Reported-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
1bdc94 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
1bdc94 |
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
1bdc94 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
1bdc94 |
(cherry picked from commit 37aec7d75eb0d035a0db4f2cf9ad8b1b0c10f91b)
|
|
|
1bdc94 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
1bdc94 |
---
|
|
|
1bdc94 |
block/io.c | 60 +++++++++++++++++++++++++++++-------------------------------
|
|
|
1bdc94 |
1 file changed, 29 insertions(+), 31 deletions(-)
|
|
|
1bdc94 |
|
|
|
1bdc94 |
diff --git a/block/io.c b/block/io.c
|
|
|
1bdc94 |
index ac36d1c..136a5d0 100644
|
|
|
1bdc94 |
--- a/block/io.c
|
|
|
1bdc94 |
+++ b/block/io.c
|
|
|
1bdc94 |
@@ -2847,6 +2847,9 @@ static int coroutine_fn bdrv_co_copy_range_internal(BdrvChild *src,
|
|
|
1bdc94 |
BdrvRequestFlags flags,
|
|
|
1bdc94 |
bool recurse_src)
|
|
|
1bdc94 |
{
|
|
|
1bdc94 |
+ BdrvTrackedRequest src_req, dst_req;
|
|
|
1bdc94 |
+ BlockDriverState *src_bs = src->bs;
|
|
|
1bdc94 |
+ BlockDriverState *dst_bs = dst->bs;
|
|
|
1bdc94 |
int ret;
|
|
|
1bdc94 |
|
|
|
1bdc94 |
if (!src || !dst || !src->bs || !dst->bs) {
|
|
|
1bdc94 |
@@ -2870,17 +2873,32 @@ static int coroutine_fn bdrv_co_copy_range_internal(BdrvChild *src,
|
|
|
1bdc94 |
|| src->bs->encrypted || dst->bs->encrypted) {
|
|
|
1bdc94 |
return -ENOTSUP;
|
|
|
1bdc94 |
}
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
+ bdrv_inc_in_flight(src_bs);
|
|
|
1bdc94 |
+ bdrv_inc_in_flight(dst_bs);
|
|
|
1bdc94 |
+ tracked_request_begin(&src_req, src_bs, src_offset,
|
|
|
1bdc94 |
+ bytes, BDRV_TRACKED_READ);
|
|
|
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 (recurse_src) {
|
|
|
1bdc94 |
- return src->bs->drv->bdrv_co_copy_range_from(src->bs,
|
|
|
1bdc94 |
- src, src_offset,
|
|
|
1bdc94 |
- dst, dst_offset,
|
|
|
1bdc94 |
- bytes, flags);
|
|
|
1bdc94 |
+ ret = src->bs->drv->bdrv_co_copy_range_from(src->bs,
|
|
|
1bdc94 |
+ src, src_offset,
|
|
|
1bdc94 |
+ dst, dst_offset,
|
|
|
1bdc94 |
+ bytes, flags);
|
|
|
1bdc94 |
} else {
|
|
|
1bdc94 |
- return dst->bs->drv->bdrv_co_copy_range_to(dst->bs,
|
|
|
1bdc94 |
- src, src_offset,
|
|
|
1bdc94 |
- dst, dst_offset,
|
|
|
1bdc94 |
- bytes, flags);
|
|
|
1bdc94 |
+ ret = dst->bs->drv->bdrv_co_copy_range_to(dst->bs,
|
|
|
1bdc94 |
+ src, src_offset,
|
|
|
1bdc94 |
+ dst, dst_offset,
|
|
|
1bdc94 |
+ bytes, flags);
|
|
|
1bdc94 |
}
|
|
|
1bdc94 |
+ tracked_request_end(&src_req);
|
|
|
1bdc94 |
+ tracked_request_end(&dst_req);
|
|
|
1bdc94 |
+ bdrv_dec_in_flight(src_bs);
|
|
|
1bdc94 |
+ bdrv_dec_in_flight(dst_bs);
|
|
|
1bdc94 |
+ return ret;
|
|
|
1bdc94 |
}
|
|
|
1bdc94 |
|
|
|
1bdc94 |
/* Copy range from @src to @dst.
|
|
|
1bdc94 |
@@ -2911,29 +2929,9 @@ int coroutine_fn bdrv_co_copy_range(BdrvChild *src, uint64_t src_offset,
|
|
|
1bdc94 |
BdrvChild *dst, uint64_t dst_offset,
|
|
|
1bdc94 |
uint64_t bytes, BdrvRequestFlags flags)
|
|
|
1bdc94 |
{
|
|
|
1bdc94 |
- BdrvTrackedRequest src_req, dst_req;
|
|
|
1bdc94 |
- BlockDriverState *src_bs = src->bs;
|
|
|
1bdc94 |
- BlockDriverState *dst_bs = dst->bs;
|
|
|
1bdc94 |
- int ret;
|
|
|
1bdc94 |
-
|
|
|
1bdc94 |
- bdrv_inc_in_flight(src_bs);
|
|
|
1bdc94 |
- bdrv_inc_in_flight(dst_bs);
|
|
|
1bdc94 |
- tracked_request_begin(&src_req, src_bs, src_offset,
|
|
|
1bdc94 |
- bytes, BDRV_TRACKED_READ);
|
|
|
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 |
- ret = bdrv_co_copy_range_from(src, src_offset,
|
|
|
1bdc94 |
- dst, dst_offset,
|
|
|
1bdc94 |
- bytes, flags);
|
|
|
1bdc94 |
-
|
|
|
1bdc94 |
- tracked_request_end(&src_req);
|
|
|
1bdc94 |
- tracked_request_end(&dst_req);
|
|
|
1bdc94 |
- bdrv_dec_in_flight(src_bs);
|
|
|
1bdc94 |
- bdrv_dec_in_flight(dst_bs);
|
|
|
1bdc94 |
- return ret;
|
|
|
1bdc94 |
+ return bdrv_co_copy_range_from(src, src_offset,
|
|
|
1bdc94 |
+ dst, dst_offset,
|
|
|
1bdc94 |
+ bytes, flags);
|
|
|
1bdc94 |
}
|
|
|
1bdc94 |
|
|
|
1bdc94 |
static void bdrv_parent_cb_resize(BlockDriverState *bs)
|
|
|
1bdc94 |
--
|
|
|
1bdc94 |
1.8.3.1
|
|
|
1bdc94 |
|