|
|
29b115 |
From 49d9c9dced7278517105e9cfec34ea4af716432d Mon Sep 17 00:00:00 2001
|
|
|
29b115 |
From: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
29b115 |
Date: Thu, 9 Jun 2022 17:47:12 +0100
|
|
|
29b115 |
Subject: [PATCH 6/6] linux-aio: explain why max batch is checked in
|
|
|
29b115 |
laio_io_unplug()
|
|
|
29b115 |
|
|
|
29b115 |
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
29b115 |
RH-MergeRequest: 102: linux-aio: fix unbalanced plugged counter in laio_io_unplug()
|
|
|
29b115 |
RH-Commit: [2/2] b3d6421086bde50d4baad2343b2df89c5f66950e (stefanha/centos-stream-qemu-kvm)
|
|
|
29b115 |
RH-Bugzilla: 2092788
|
|
|
29b115 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
29b115 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
29b115 |
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
29b115 |
|
|
|
29b115 |
It may not be obvious why laio_io_unplug() checks max batch. I discussed
|
|
|
29b115 |
this with Stefano and have added a comment summarizing the reason.
|
|
|
29b115 |
|
|
|
29b115 |
Cc: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
29b115 |
Cc: Kevin Wolf <kwolf@redhat.com>
|
|
|
29b115 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
29b115 |
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
29b115 |
Message-id: 20220609164712.1539045-3-stefanha@redhat.com
|
|
|
29b115 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
29b115 |
(cherry picked from commit 99b969fbe105117f5af6060d3afef40ca39cc9c1)
|
|
|
29b115 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
29b115 |
---
|
|
|
29b115 |
block/linux-aio.c | 6 ++++++
|
|
|
29b115 |
1 file changed, 6 insertions(+)
|
|
|
29b115 |
|
|
|
29b115 |
diff --git a/block/linux-aio.c b/block/linux-aio.c
|
|
|
29b115 |
index 6078da7e42..9c2393a2f7 100644
|
|
|
29b115 |
--- a/block/linux-aio.c
|
|
|
29b115 |
+++ b/block/linux-aio.c
|
|
|
29b115 |
@@ -365,6 +365,12 @@ void laio_io_unplug(BlockDriverState *bs, LinuxAioState *s,
|
|
|
29b115 |
assert(s->io_q.plugged);
|
|
|
29b115 |
s->io_q.plugged--;
|
|
|
29b115 |
|
|
|
29b115 |
+ /*
|
|
|
29b115 |
+ * Why max batch checking is performed here:
|
|
|
29b115 |
+ * Another BDS may have queued requests with a higher dev_max_batch and
|
|
|
29b115 |
+ * therefore in_queue could now exceed our dev_max_batch. Re-check the max
|
|
|
29b115 |
+ * batch so we can honor our device's dev_max_batch.
|
|
|
29b115 |
+ */
|
|
|
29b115 |
if (s->io_q.in_queue >= laio_max_batch(s, dev_max_batch) ||
|
|
|
29b115 |
(!s->io_q.plugged &&
|
|
|
29b115 |
!s->io_q.blocked && !QSIMPLEQ_EMPTY(&s->io_q.pending))) {
|
|
|
29b115 |
--
|
|
|
29b115 |
2.31.1
|
|
|
29b115 |
|