[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 3/5] block-backend: process I/O in the current AioContext
From: |
Stefan Hajnoczi |
Subject: |
[PATCH v3 3/5] block-backend: process I/O in the current AioContext |
Date: |
Tue, 12 Sep 2023 19:10:35 -0400 |
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>
---
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
- [PATCH v3 0/5] block-backend: process I/O in the current AioContext, Stefan Hajnoczi, 2023/09/12
- [PATCH v3 1/5] block: remove AIOCBInfo->get_aio_context(), Stefan Hajnoczi, 2023/09/12
- [PATCH v3 2/5] test-bdrv-drain: avoid race with BH in IOThread drain test, Stefan Hajnoczi, 2023/09/12
- [PATCH v3 3/5] block-backend: process I/O in the current AioContext,
Stefan Hajnoczi <=
- [PATCH v3 4/5] block-backend: process zoned requests in the current AioContext, Stefan Hajnoczi, 2023/09/12
- [PATCH v3 5/5] block-coroutine-wrapper: use qemu_get_current_aio_context(), Stefan Hajnoczi, 2023/09/12
- Re: [PATCH v3 0/5] block-backend: process I/O in the current AioContext, Kevin Wolf, 2023/09/15