[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 18/18] linux-aio: explain why max batch is checked in laio_io_unpl
From: |
Stefan Hajnoczi |
Subject: |
[PULL 18/18] linux-aio: explain why max batch is checked in laio_io_unplug() |
Date: |
Wed, 15 Jun 2022 16:51:29 +0100 |
It may not be obvious why laio_io_unplug() checks max batch. I discussed
this with Stefano and have added a comment summarizing the reason.
Cc: Stefano Garzarella <sgarzare@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Message-id: 20220609164712.1539045-3-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
block/linux-aio.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/block/linux-aio.c b/block/linux-aio.c
index 6078da7e42..9c2393a2f7 100644
--- a/block/linux-aio.c
+++ b/block/linux-aio.c
@@ -365,6 +365,12 @@ void laio_io_unplug(BlockDriverState *bs, LinuxAioState *s,
assert(s->io_q.plugged);
s->io_q.plugged--;
+ /*
+ * Why max batch checking is performed here:
+ * Another BDS may have queued requests with a higher dev_max_batch and
+ * therefore in_queue could now exceed our dev_max_batch. Re-check the max
+ * batch so we can honor our device's dev_max_batch.
+ */
if (s->io_q.in_queue >= laio_max_batch(s, dev_max_batch) ||
(!s->io_q.plugged &&
!s->io_q.blocked && !QSIMPLEQ_EMPTY(&s->io_q.pending))) {
--
2.36.1
- [PULL 08/18] vfio-user: instantiate vfio-user context, (continued)
- [PULL 08/18] vfio-user: instantiate vfio-user context, Stefan Hajnoczi, 2022/06/15
- [PULL 09/18] vfio-user: find and init PCI device, Stefan Hajnoczi, 2022/06/15
- [PULL 11/18] vfio-user: handle PCI config space accesses, Stefan Hajnoczi, 2022/06/15
- [PULL 10/18] vfio-user: run vfio-user context, Stefan Hajnoczi, 2022/06/15
- [PULL 07/18] vfio-user: define vfio-user-server object, Stefan Hajnoczi, 2022/06/15
- [PULL 13/18] vfio-user: handle DMA mappings, Stefan Hajnoczi, 2022/06/15
- [PULL 14/18] vfio-user: handle PCI BAR accesses, Stefan Hajnoczi, 2022/06/15
- [PULL 16/18] vfio-user: handle reset of remote device, Stefan Hajnoczi, 2022/06/15
- [PULL 12/18] vfio-user: IOMMU support for remote device, Stefan Hajnoczi, 2022/06/15
- [PULL 15/18] vfio-user: handle device interrupts, Stefan Hajnoczi, 2022/06/15
- [PULL 18/18] linux-aio: explain why max batch is checked in laio_io_unplug(),
Stefan Hajnoczi <=
- [PULL 17/18] linux-aio: fix unbalanced plugged counter in laio_io_unplug(), Stefan Hajnoczi, 2022/06/15
- Re: [PULL 00/18] Block patches, Richard Henderson, 2022/06/15