All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Cody <jcody@redhat.com>
To: qemu-block@nongnu.org
Cc: peter.maydell@linaro.org, jcody@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 09/14] mirror: fix request throttling in drive-mirror
Date: Tue, 19 Jul 2016 20:20:57 -0400	[thread overview]
Message-ID: <1468974062-7726-10-git-send-email-jcody@redhat.com> (raw)
In-Reply-To: <1468974062-7726-1-git-send-email-jcody@redhat.com>

From: "Denis V. Lunev" <den@openvz.org>

There are 2 deficiencies here:
- mirror_iteration could start several requests inside. Thus we could
  simply have more in_flight requests than MAX_IN_FLIGHT.
- keeping this in mind throttling in mirror_run which is checking
  s->in_flight == MAX_IN_FLIGHT is wrong.

The patch adds the check and throttling into mirror_iteration and fixes
the check in mirror_run() to be sure.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-id: 1466598927-5990-1-git-send-email-den@openvz.org
CC: Jeff Cody <jcody@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Max Reitz <mreitz@redhat.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
(cherry picked from commit e648dc95c28fbca12e67be26a1fc4b9a0676c3fe)
---
 block/mirror.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/block/mirror.c b/block/mirror.c
index f78186d..836a5d0 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -407,6 +407,11 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)
             }
         }
 
+        while (s->in_flight >= MAX_IN_FLIGHT) {
+            trace_mirror_yield_in_flight(s, sector_num, s->in_flight);
+            mirror_wait_for_io(s);
+        }
+
         mirror_clip_sectors(s, sector_num, &io_sectors);
         switch (mirror_method) {
         case MIRROR_METHOD_COPY:
@@ -695,7 +700,7 @@ static void coroutine_fn mirror_run(void *opaque)
         delta = qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - s->last_pause_ns;
         if (delta < SLICE_TIME &&
             s->common.iostatus == BLOCK_DEVICE_IO_STATUS_OK) {
-            if (s->in_flight == MAX_IN_FLIGHT || s->buf_free_count == 0 ||
+            if (s->in_flight >= MAX_IN_FLIGHT || s->buf_free_count == 0 ||
                 (cnt == 0 && s->in_flight > 0)) {
                 trace_mirror_yield(s, s->in_flight, s->buf_free_count, cnt);
                 mirror_wait_for_io(s);
-- 
1.9.3

  parent reply	other threads:[~2016-07-20  0:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-20  0:20 [Qemu-devel] [PULL 00/14] Block patches Jeff Cody
2016-07-20  0:20 ` [Qemu-devel] [PULL 01/14] dirty-bitmap: operate with int64_t amount Jeff Cody
2016-07-20  0:20 ` [Qemu-devel] [PULL 02/14] mirror: make sectors_in_flight int64_t Jeff Cody
2016-07-20  0:20 ` [Qemu-devel] [PULL 03/14] mirror: create mirror_throttle helper Jeff Cody
2016-07-20  0:20 ` [Qemu-devel] [PULL 04/14] mirror: create mirror_dirty_init helper for mirror_run Jeff Cody
2016-07-20  0:20 ` [Qemu-devel] [PULL 05/14] block: remove extra condition in bdrv_can_write_zeroes_with_unmap Jeff Cody
2016-07-20  0:20 ` [Qemu-devel] [PULL 06/14] mirror: optimize dirty bitmap filling in mirror_run a bit Jeff Cody
2016-07-20  0:20 ` [Qemu-devel] [PULL 07/14] mirror: efficiently zero out target Jeff Cody
2016-07-20  0:20 ` [Qemu-devel] [PULL 08/14] mirror: improve performance of mirroring of empty disk Jeff Cody
2016-07-20  0:20 ` Jeff Cody [this message]
2016-07-20  0:20 ` [Qemu-devel] [PULL 10/14] block/gluster: rename [server, volname, image] -> [host, volume, path] Jeff Cody
2016-07-20  0:20 ` [Qemu-devel] [PULL 11/14] block/gluster: code cleanup Jeff Cody
2016-07-20  0:21 ` [Qemu-devel] [PULL 12/14] block/gluster: deprecate rdma support Jeff Cody
2016-07-20  0:21 ` [Qemu-devel] [PULL 13/14] block/gluster: using new qapi schema Jeff Cody
2016-07-20 21:24   ` Eric Blake
2016-07-20 21:40     ` Jeff Cody
2016-07-20  0:21 ` [Qemu-devel] [PULL 14/14] block/gluster: add support for multiple gluster servers Jeff Cody
2016-07-20 17:51 ` [Qemu-devel] [PULL 00/14] Block patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1468974062-7726-10-git-send-email-jcody@redhat.com \
    --to=jcody@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.