0a122b
From b66f204fcdb797b85050f3f6af6b4967247fd0f5 Mon Sep 17 00:00:00 2001
0a122b
From: Kevin Wolf <kwolf@redhat.com>
0a122b
Date: Tue, 3 Dec 2013 14:30:44 +0100
0a122b
Subject: [PATCH 14/37] block: write: Handle COR dependency after I/O throttling
0a122b
0a122b
Message-id: <1392117622-28812-15-git-send-email-kwolf@redhat.com>
0a122b
Patchwork-id: 57179
0a122b
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 14/37] block: write: Handle COR dependency after I/O throttling
0a122b
Bugzilla: 748906
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
RH-Acked-by: Max Reitz <mreitz@redhat.com>
0a122b
0a122b
First waiting for all COR requests to complete and calling the
0a122b
throttling function afterwards means that the request could be delayed
0a122b
and we still need to wait for the COR request even if it was issued only
0a122b
after the throttled write request.
0a122b
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
Reviewed-by: Max Reitz <mreitz@redhat.com>
0a122b
Reviewed-by: Benoit Canet <benoit@irqsave.net>
0a122b
(cherry picked from commit 244eadef5c797c674b0aef96366671be4b33d03a)
0a122b
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
---
0a122b
 block.c | 8 ++++----
0a122b
 1 file changed, 4 insertions(+), 4 deletions(-)
0a122b
---
0a122b
 block.c |    8 ++++----
0a122b
 1 files changed, 4 insertions(+), 4 deletions(-)
0a122b
0a122b
diff --git a/block.c b/block.c
0a122b
index e6b6ed4..d8168f5 100644
0a122b
--- a/block.c
0a122b
+++ b/block.c
0a122b
@@ -2997,6 +2997,10 @@ static int coroutine_fn bdrv_aligned_pwritev(BlockDriverState *bs,
0a122b
     assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0);
0a122b
     assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0);
0a122b
 
0a122b
+    if (bs->copy_on_read_in_flight) {
0a122b
+        wait_for_overlapping_requests(bs, sector_num, nb_sectors);
0a122b
+    }
0a122b
+
0a122b
     tracked_request_begin(&req, bs, sector_num, nb_sectors, true);
0a122b
 
0a122b
     if (flags & BDRV_REQ_ZERO_WRITE) {
0a122b
@@ -3044,10 +3048,6 @@ static int coroutine_fn bdrv_co_do_writev(BlockDriverState *bs,
0a122b
         return -EIO;
0a122b
     }
0a122b
 
0a122b
-    if (bs->copy_on_read_in_flight) {
0a122b
-        wait_for_overlapping_requests(bs, sector_num, nb_sectors);
0a122b
-    }
0a122b
-
0a122b
     /* throttling disk I/O */
0a122b
     if (bs->io_limits_enabled) {
0a122b
         bdrv_io_limits_intercept(bs, true, nb_sectors);
0a122b
-- 
0a122b
1.7.1
0a122b