mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-31 14:23:53 -06:00
block: remove AioContext locking
This is the big patch that removes aio_context_acquire()/aio_context_release() from the block layer and affected block layer users. There isn't a clean way to split this patch and the reviewers are likely the same group of people, so I decided to do it in one patch. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Paul Durrant <paul@xen.org> Message-ID: <20231205182011.1976568-7-stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
6bc30f1949
commit
b49f4755c7
41 changed files with 104 additions and 1169 deletions
|
@ -260,8 +260,6 @@ static void xen_block_complete_aio(void *opaque, int ret)
|
|||
XenBlockRequest *request = opaque;
|
||||
XenBlockDataPlane *dataplane = request->dataplane;
|
||||
|
||||
aio_context_acquire(dataplane->ctx);
|
||||
|
||||
if (ret != 0) {
|
||||
error_report("%s I/O error",
|
||||
request->req.operation == BLKIF_OP_READ ?
|
||||
|
@ -273,10 +271,10 @@ static void xen_block_complete_aio(void *opaque, int ret)
|
|||
if (request->presync) {
|
||||
request->presync = 0;
|
||||
xen_block_do_aio(request);
|
||||
goto done;
|
||||
return;
|
||||
}
|
||||
if (request->aio_inflight > 0) {
|
||||
goto done;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (request->req.operation) {
|
||||
|
@ -318,9 +316,6 @@ static void xen_block_complete_aio(void *opaque, int ret)
|
|||
if (dataplane->more_work) {
|
||||
qemu_bh_schedule(dataplane->bh);
|
||||
}
|
||||
|
||||
done:
|
||||
aio_context_release(dataplane->ctx);
|
||||
}
|
||||
|
||||
static bool xen_block_split_discard(XenBlockRequest *request,
|
||||
|
@ -601,9 +596,7 @@ static void xen_block_dataplane_bh(void *opaque)
|
|||
{
|
||||
XenBlockDataPlane *dataplane = opaque;
|
||||
|
||||
aio_context_acquire(dataplane->ctx);
|
||||
xen_block_handle_requests(dataplane);
|
||||
aio_context_release(dataplane->ctx);
|
||||
}
|
||||
|
||||
static bool xen_block_dataplane_event(void *opaque)
|
||||
|
@ -703,10 +696,8 @@ void xen_block_dataplane_stop(XenBlockDataPlane *dataplane)
|
|||
xen_block_dataplane_detach(dataplane);
|
||||
}
|
||||
|
||||
aio_context_acquire(dataplane->ctx);
|
||||
/* Xen doesn't have multiple users for nodes, so this can't fail */
|
||||
blk_set_aio_context(dataplane->blk, qemu_get_aio_context(), &error_abort);
|
||||
aio_context_release(dataplane->ctx);
|
||||
|
||||
/*
|
||||
* Now that the context has been moved onto the main thread, cancel
|
||||
|
@ -752,7 +743,6 @@ void xen_block_dataplane_start(XenBlockDataPlane *dataplane,
|
|||
{
|
||||
ERRP_GUARD();
|
||||
XenDevice *xendev = dataplane->xendev;
|
||||
AioContext *old_context;
|
||||
unsigned int ring_size;
|
||||
unsigned int i;
|
||||
|
||||
|
@ -836,11 +826,8 @@ void xen_block_dataplane_start(XenBlockDataPlane *dataplane,
|
|||
goto stop;
|
||||
}
|
||||
|
||||
old_context = blk_get_aio_context(dataplane->blk);
|
||||
aio_context_acquire(old_context);
|
||||
/* If other users keep the BlockBackend in the iothread, that's ok */
|
||||
blk_set_aio_context(dataplane->blk, dataplane->ctx, NULL);
|
||||
aio_context_release(old_context);
|
||||
|
||||
if (!blk_in_drain(dataplane->blk)) {
|
||||
xen_block_dataplane_attach(dataplane);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue