[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 11/13] test-bdrv-drain: AioContext switch in drai
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH v2 11/13] test-bdrv-drain: AioContext switch in drained section |
Date: |
Wed, 20 Feb 2019 18:48:41 +0100 |
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
tests/test-bdrv-drain.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/tests/test-bdrv-drain.c b/tests/test-bdrv-drain.c
index ee1740ff06..1b1f6c17a5 100644
--- a/tests/test-bdrv-drain.c
+++ b/tests/test-bdrv-drain.c
@@ -1522,6 +1522,36 @@ static void test_append_to_drained(void)
blk_unref(blk);
}
+static void test_set_aio_context(void)
+{
+ BlockDriverState *bs;
+ IOThread *a = iothread_new();
+ IOThread *b = iothread_new();
+ AioContext *ctx_a = iothread_get_aio_context(a);
+ AioContext *ctx_b = iothread_get_aio_context(b);
+
+ bs = bdrv_new_open_driver(&bdrv_test, "test-node", BDRV_O_RDWR,
+ &error_abort);
+
+ bdrv_drained_begin(bs);
+ bdrv_set_aio_context(bs, ctx_a);
+
+ aio_context_acquire(ctx_a);
+ bdrv_drained_end(bs);
+
+ bdrv_drained_begin(bs);
+ bdrv_set_aio_context(bs, ctx_b);
+ aio_context_release(ctx_a);
+ aio_context_acquire(ctx_b);
+ bdrv_set_aio_context(bs, qemu_get_aio_context());
+ aio_context_release(ctx_b);
+ bdrv_drained_end(bs);
+
+ bdrv_unref(bs);
+ iothread_join(a);
+ iothread_join(b);
+}
+
int main(int argc, char **argv)
{
int ret;
@@ -1603,6 +1633,8 @@ int main(int argc, char **argv)
g_test_add_func("/bdrv-drain/attach/drain", test_append_to_drained);
+ g_test_add_func("/bdrv-drain/set_aio_context", test_set_aio_context);
+
ret = g_test_run();
qemu_event_destroy(&done_event);
return ret;
--
2.20.1
- Re: [Qemu-devel] [PATCH v2 05/13] io: Remove redundant read/write_coroutine assignments, (continued)
[Qemu-devel] [PATCH v2 04/13] io: Make qio_channel_yield() interruptible, Kevin Wolf, 2019/02/20
[Qemu-devel] [PATCH v2 06/13] nbd: Move nbd_read_eof() to nbd/client.c, Kevin Wolf, 2019/02/20
[Qemu-devel] [PATCH v2 09/13] block: Don't poll in bdrv_set_aio_context(), Kevin Wolf, 2019/02/20
[Qemu-devel] [PATCH v2 07/13] nbd: Use low-level QIOChannel API in nbd_read_eof(), Kevin Wolf, 2019/02/20
[Qemu-devel] [PATCH v2 08/13] nbd: Increase bs->in_flight during AioContext switch, Kevin Wolf, 2019/02/20
[Qemu-devel] [PATCH v2 10/13] block: Fix AioContext switch for drained node, Kevin Wolf, 2019/02/20
[Qemu-devel] [PATCH v2 11/13] test-bdrv-drain: AioContext switch in drained section,
Kevin Wolf <=
[Qemu-devel] [PATCH v2 12/13] block: Use normal drain for bdrv_set_aio_context(), Kevin Wolf, 2019/02/20
[Qemu-devel] [PATCH v2 13/13] aio-posix: Assert that aio_poll() is always called in home thread, Kevin Wolf, 2019/02/20
Re: [Qemu-devel] [PATCH v2 00/13] block: bdrv_set_aio_context() related fixes, Kevin Wolf, 2019/02/25