[v2,7/9] block: Use common req handling in copy offloading
diff mbox series

Message ID 20180705073701.10558-8-famz@redhat.com
State New
Headers show
Series
  • block: Fix dst reading after tail copy offloading
Related show

Commit Message

Fam Zheng July 5, 2018, 7:36 a.m. UTC
This brings the request handling logic inline with write and discard,
fixing write_gen, resize_cb, dirty bitmaps and image size refreshing.
The last of these issues broke iotest case 222, which is now fixed.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/io.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/block/io.c b/block/io.c
index 912fcb962a..d07849fa96 100644
--- a/block/io.c
+++ b/block/io.c
@@ -2962,7 +2962,11 @@  static int coroutine_fn bdrv_co_copy_range_internal(BdrvChild *src,
 
     if (!(flags & BDRV_REQ_NO_SERIALISING)) {
         wait_serialising_requests(&src_req);
-        wait_serialising_requests(&dst_req);
+    }
+
+    ret = bdrv_co_write_req_prepare(dst, &dst_req, flags);
+    if (ret) {
+        goto out;
     }
     if (recurse_src) {
         ret = src->bs->drv->bdrv_co_copy_range_from(src->bs,
@@ -2975,6 +2979,8 @@  static int coroutine_fn bdrv_co_copy_range_internal(BdrvChild *src,
                                                   dst, dst_offset,
                                                   bytes, flags);
     }
+out:
+    bdrv_co_write_req_finish(dst, &dst_req, ret);
     tracked_request_end(&src_req);
     tracked_request_end(&dst_req);
     bdrv_dec_in_flight(src->bs);