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

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