qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: [PULL 11/14] block-backend: process I/O in the current AioContext
Date: Mon,  4 Sep 2023 16:36:40 +0200	[thread overview]
Message-ID: <20230904143643.259916-12-kwolf@redhat.com> (raw)
In-Reply-To: <20230904143643.259916-1-kwolf@redhat.com>

From: Stefan Hajnoczi <stefanha@redhat.com>

Switch blk_aio_*() APIs over to multi-queue by using
qemu_get_current_aio_context() instead of blk_get_aio_context(). This
change will allow devices to process I/O in multiple IOThreads in the
future.

I audited existing blk_aio_*() callers:
- migration/block.c: blk_mig_lock() protects the data accessed by the
  completion callback.
- The remaining emulated devices and exports run with
  qemu_get_aio_context() == blk_get_aio_context().

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20230823235938.1398382-3-stefanha@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/block-backend.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/block/block-backend.c b/block/block-backend.c
index a77295a198..4863be5691 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -1530,7 +1530,7 @@ BlockAIOCB *blk_abort_aio_request(BlockBackend *blk,
     acb->blk = blk;
     acb->ret = ret;
 
-    replay_bh_schedule_oneshot_event(blk_get_aio_context(blk),
+    replay_bh_schedule_oneshot_event(qemu_get_current_aio_context(),
                                      error_callback_bh, acb);
     return &acb->common;
 }
@@ -1584,11 +1584,11 @@ static BlockAIOCB *blk_aio_prwv(BlockBackend *blk, int64_t offset,
     acb->has_returned = false;
 
     co = qemu_coroutine_create(co_entry, acb);
-    aio_co_enter(blk_get_aio_context(blk), co);
+    aio_co_enter(qemu_get_current_aio_context(), co);
 
     acb->has_returned = true;
     if (acb->rwco.ret != NOT_DONE) {
-        replay_bh_schedule_oneshot_event(blk_get_aio_context(blk),
+        replay_bh_schedule_oneshot_event(qemu_get_current_aio_context(),
                                          blk_aio_complete_bh, acb);
     }
 
-- 
2.41.0



  parent reply	other threads:[~2023-09-04 14:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-04 14:36 [PULL 00/14] Block layer patches Kevin Wolf
2023-09-04 14:36 ` [PULL 01/14] block/vpc: Avoid dynamic stack allocation Kevin Wolf
2023-09-04 14:36 ` [PULL 02/14] iotests: adapt test output for new qemu_cleanup() behavior Kevin Wolf
2023-09-04 14:36 ` [PULL 03/14] block: minimize bs->reqs_lock section in tracked_request_end() Kevin Wolf
2023-09-04 14:36 ` [PULL 04/14] block: change reqs_lock to QemuMutex Kevin Wolf
2023-09-04 14:36 ` [PULL 05/14] qemu-img: omit errno value in error message Kevin Wolf
2023-09-04 14:36 ` [PULL 06/14] block/iscsi: Document why we use raw malloc() Kevin Wolf
2023-09-04 14:36 ` [PULL 07/14] block: Be more verbose in create fallback Kevin Wolf
2023-09-04 14:36 ` [PULL 08/14] qemu-img: Update documentation for compressed images Kevin Wolf
2023-09-04 14:36 ` [PULL 09/14] vmdk: Clean up bdrv_open_child() return value check Kevin Wolf
2023-09-04 14:36 ` [PULL 10/14] block: remove AIOCBInfo->get_aio_context() Kevin Wolf
2023-09-04 14:36 ` Kevin Wolf [this message]
2023-09-04 14:36 ` [PULL 12/14] block-backend: process zoned requests in the current AioContext Kevin Wolf
2023-09-04 14:36 ` [PULL 13/14] block: Remove bdrv_query_block_node_info Kevin Wolf
2023-09-04 14:36 ` [PULL 14/14] block: Remove unnecessary variable in bdrv_block_device_info Kevin Wolf
2023-09-06 15:13 ` [PULL 00/14] Block layer patches Stefan Hajnoczi
2023-09-07  8:17   ` Kevin Wolf

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=20230904143643.259916-12-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).