[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 13/71] io: Remove redundant read/write_coroutine assi
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 13/71] io: Remove redundant read/write_coroutine assignments |
Date: |
Mon, 25 Feb 2019 16:19:55 +0100 |
qio_channel_yield() now updates ioc->read_write/coroutine and calls
qio_channel_set_aio_fd_handlers(), so the code in the handlers has
become redundant and can be removed.
This does not make a difference in intermediate states because
aio_co_wake() really enters the coroutine immediately here: These
handlers are never run in coroutine context, and we're in the right
AioContext because qio_channel_attach_aio_context() asserts that the
handlers are inactive.
To make these conditions more obvious, assert the right AioContext.
Suggested-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
io/channel.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/io/channel.c b/io/channel.c
index 303376e08d..2a26c2a2c0 100644
--- a/io/channel.c
+++ b/io/channel.c
@@ -400,15 +400,14 @@ off_t qio_channel_io_seek(QIOChannel *ioc,
}
-static void qio_channel_set_aio_fd_handlers(QIOChannel *ioc);
-
static void qio_channel_restart_read(void *opaque)
{
QIOChannel *ioc = opaque;
Coroutine *co = ioc->read_coroutine;
- ioc->read_coroutine = NULL;
- qio_channel_set_aio_fd_handlers(ioc);
+ /* Assert that aio_co_wake() reenters the coroutine directly */
+ assert(qemu_get_current_aio_context() ==
+ qemu_coroutine_get_aio_context(co));
aio_co_wake(co);
}
@@ -417,8 +416,9 @@ static void qio_channel_restart_write(void *opaque)
QIOChannel *ioc = opaque;
Coroutine *co = ioc->write_coroutine;
- ioc->write_coroutine = NULL;
- qio_channel_set_aio_fd_handlers(ioc);
+ /* Assert that aio_co_wake() reenters the coroutine directly */
+ assert(qemu_get_current_aio_context() ==
+ qemu_coroutine_get_aio_context(co));
aio_co_wake(co);
}
--
2.20.1
- [Qemu-block] [PULL 03/71] block/snapshot.c: eliminate use of ID input in snapshot operations, (continued)
- [Qemu-block] [PULL 03/71] block/snapshot.c: eliminate use of ID input in snapshot operations, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 04/71] block/snapshot: remove bdrv_snapshot_delete_by_id_or_name, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 05/71] qcow2-snapshot: remove redundant find_snapshot_by_id_and_name call, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 07/71] commit: Replace commit_top_bs on failure after deleting the block job, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 06/71] block: don't set the same context, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 08/71] qemu-img: fix error reporting for -object, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 09/71] block-backend: Make blk_inc/dec_in_flight public, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 10/71] virtio-blk: Increase in_flight for request restart BH, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 11/71] nbd: Restrict connection_co reentrance, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 12/71] io: Make qio_channel_yield() interruptible, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 13/71] io: Remove redundant read/write_coroutine assignments,
Kevin Wolf <=
- [Qemu-block] [PULL 14/71] nbd: Move nbd_read_eof() to nbd/client.c, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 18/71] block: Fix AioContext switch for drained node, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 20/71] block: Use normal drain for bdrv_set_aio_context(), Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 16/71] nbd: Increase bs->in_flight during AioContext switch, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 17/71] block: Don't poll in bdrv_set_aio_context(), Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 15/71] nbd: Use low-level QIOChannel API in nbd_read_eof(), Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 19/71] test-bdrv-drain: AioContext switch in drained section, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 21/71] aio-posix: Assert that aio_poll() is always called in home thread, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 22/71] block: improve should_update_child, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 23/71] block: fix bdrv_check_perm for non-tree subgraph, Kevin Wolf, 2019/02/25