diff options
Diffstat (limited to 'block/linux-aio.c')
-rw-r--r-- | block/linux-aio.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/block/linux-aio.c b/block/linux-aio.c index 5c104bd3cd..1d702a5fc6 100644 --- a/block/linux-aio.c +++ b/block/linux-aio.c @@ -50,6 +50,8 @@ typedef struct { } LaioQueue; struct LinuxAioState { + AioContext *aio_context; + io_context_t ctx; EventNotifier e; @@ -227,15 +229,14 @@ static void ioq_submit(LinuxAioState *s) void laio_io_plug(BlockDriverState *bs, LinuxAioState *s) { - assert(!s->io_q.plugged); - s->io_q.plugged = 1; + s->io_q.plugged++; } void laio_io_unplug(BlockDriverState *bs, LinuxAioState *s) { assert(s->io_q.plugged); - s->io_q.plugged = 0; - if (!s->io_q.blocked && !QSIMPLEQ_EMPTY(&s->io_q.pending)) { + if (--s->io_q.plugged == 0 && + !s->io_q.blocked && !QSIMPLEQ_EMPTY(&s->io_q.pending)) { ioq_submit(s); } } @@ -325,6 +326,7 @@ void laio_detach_aio_context(LinuxAioState *s, AioContext *old_context) void laio_attach_aio_context(LinuxAioState *s, AioContext *new_context) { + s->aio_context = new_context; s->completion_bh = aio_bh_new(new_context, qemu_laio_completion_bh, s); aio_set_event_notifier(new_context, &s->e, false, qemu_laio_completion_cb); |