Blame SOURCES/kvm-block-mirror-Drop-mirror_wait_for_any_operation.patch

bf143f
From 57c79ed20cb73aa9aa4dd7487379b85ea3f936f6 Mon Sep 17 00:00:00 2001
bf143f
From: Hanna Reitz <hreitz@redhat.com>
bf143f
Date: Wed, 9 Nov 2022 17:54:49 +0100
bf143f
Subject: [PATCH 02/11] block/mirror: Drop mirror_wait_for_any_operation()
bf143f
bf143f
RH-Author: Hanna Czenczek <hreitz@redhat.com>
bf143f
RH-MergeRequest: 246: block/mirror: Make active mirror progress even under full load
bf143f
RH-Bugzilla: 2125119
bf143f
RH-Acked-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
bf143f
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
bf143f
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
bf143f
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
bf143f
RH-Commit: [2/3] dec37883bcc491441ae08d9592d1ec26a47765c0
bf143f
bf143f
mirror_wait_for_free_in_flight_slot() is the only remaining user of
bf143f
mirror_wait_for_any_operation(), so inline the latter into the former.
bf143f
bf143f
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
bf143f
Message-Id: <20221109165452.67927-3-hreitz@redhat.com>
bf143f
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
bf143f
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
bf143f
(cherry picked from commit eb994912993077f178ccb43b20e422ecf9ae4ac7)
bf143f
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
bf143f
---
bf143f
 block/mirror.c | 21 ++++++++-------------
bf143f
 1 file changed, 8 insertions(+), 13 deletions(-)
bf143f
bf143f
diff --git a/block/mirror.c b/block/mirror.c
bf143f
index 282f428cb7..6b02555ad7 100644
bf143f
--- a/block/mirror.c
bf143f
+++ b/block/mirror.c
bf143f
@@ -304,19 +304,21 @@ static int mirror_cow_align(MirrorBlockJob *s, int64_t *offset,
bf143f
 }
bf143f
 
bf143f
 static inline void coroutine_fn
bf143f
-mirror_wait_for_any_operation(MirrorBlockJob *s, bool active)
bf143f
+mirror_wait_for_free_in_flight_slot(MirrorBlockJob *s)
bf143f
 {
bf143f
     MirrorOp *op;
bf143f
 
bf143f
     QTAILQ_FOREACH(op, &s->ops_in_flight, next) {
bf143f
-        /* Do not wait on pseudo ops, because it may in turn wait on
bf143f
+        /*
bf143f
+         * Do not wait on pseudo ops, because it may in turn wait on
bf143f
          * some other operation to start, which may in fact be the
bf143f
          * caller of this function.  Since there is only one pseudo op
bf143f
          * at any given time, we will always find some real operation
bf143f
-         * to wait on. */
bf143f
-        if (!op->is_pseudo_op && op->is_in_flight &&
bf143f
-            op->is_active_write == active)
bf143f
-        {
bf143f
+         * to wait on.
bf143f
+         * Also, do not wait on active operations, because they do not
bf143f
+         * use up in-flight slots.
bf143f
+         */
bf143f
+        if (!op->is_pseudo_op && op->is_in_flight && !op->is_active_write) {
bf143f
             qemu_co_queue_wait(&op->waiting_requests, NULL);
bf143f
             return;
bf143f
         }
bf143f
@@ -324,13 +326,6 @@ mirror_wait_for_any_operation(MirrorBlockJob *s, bool active)
bf143f
     abort();
bf143f
 }
bf143f
 
bf143f
-static inline void coroutine_fn
bf143f
-mirror_wait_for_free_in_flight_slot(MirrorBlockJob *s)
bf143f
-{
bf143f
-    /* Only non-active operations use up in-flight slots */
bf143f
-    mirror_wait_for_any_operation(s, false);
bf143f
-}
bf143f
-
bf143f
 /* Perform a mirror copy operation.
bf143f
  *
bf143f
  * *op->bytes_handled is set to the number of bytes copied after and
bf143f
-- 
bf143f
2.37.3
bf143f