|
|
4ec855 |
From 7db4d6a7b791006e5b927d0a30f0106ce0c8b14d Mon Sep 17 00:00:00 2001
|
|
|
4ec855 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
4ec855 |
Date: Wed, 14 Aug 2019 08:42:28 +0100
|
|
|
4ec855 |
Subject: [PATCH 05/10] test-bdrv-drain: AioContext switch in drained section
|
|
|
4ec855 |
|
|
|
4ec855 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
4ec855 |
Message-id: <20190814084229.6458-5-kwolf@redhat.com>
|
|
|
4ec855 |
Patchwork-id: 89965
|
|
|
4ec855 |
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH 4/5] test-bdrv-drain: AioContext switch in drained section
|
|
|
4ec855 |
Bugzilla: 1716349
|
|
|
4ec855 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
4ec855 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
4ec855 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
4ec855 |
|
|
|
4ec855 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
4ec855 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
4ec855 |
(cherry picked from commit 247d2737715833525725d27e5cecf5840c62f900)
|
|
|
4ec855 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
4ec855 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
4ec855 |
---
|
|
|
4ec855 |
tests/test-bdrv-drain.c | 32 ++++++++++++++++++++++++++++++++
|
|
|
4ec855 |
1 file changed, 32 insertions(+)
|
|
|
4ec855 |
|
|
|
4ec855 |
diff --git a/tests/test-bdrv-drain.c b/tests/test-bdrv-drain.c
|
|
|
4ec855 |
index 8641b54..05c6f12 100644
|
|
|
4ec855 |
--- a/tests/test-bdrv-drain.c
|
|
|
4ec855 |
+++ b/tests/test-bdrv-drain.c
|
|
|
4ec855 |
@@ -1521,6 +1521,36 @@ static void test_append_to_drained(void)
|
|
|
4ec855 |
blk_unref(blk);
|
|
|
4ec855 |
}
|
|
|
4ec855 |
|
|
|
4ec855 |
+static void test_set_aio_context(void)
|
|
|
4ec855 |
+{
|
|
|
4ec855 |
+ BlockDriverState *bs;
|
|
|
4ec855 |
+ IOThread *a = iothread_new();
|
|
|
4ec855 |
+ IOThread *b = iothread_new();
|
|
|
4ec855 |
+ AioContext *ctx_a = iothread_get_aio_context(a);
|
|
|
4ec855 |
+ AioContext *ctx_b = iothread_get_aio_context(b);
|
|
|
4ec855 |
+
|
|
|
4ec855 |
+ bs = bdrv_new_open_driver(&bdrv_test, "test-node", BDRV_O_RDWR,
|
|
|
4ec855 |
+ &error_abort);
|
|
|
4ec855 |
+
|
|
|
4ec855 |
+ bdrv_drained_begin(bs);
|
|
|
4ec855 |
+ bdrv_set_aio_context(bs, ctx_a);
|
|
|
4ec855 |
+
|
|
|
4ec855 |
+ aio_context_acquire(ctx_a);
|
|
|
4ec855 |
+ bdrv_drained_end(bs);
|
|
|
4ec855 |
+
|
|
|
4ec855 |
+ bdrv_drained_begin(bs);
|
|
|
4ec855 |
+ bdrv_set_aio_context(bs, ctx_b);
|
|
|
4ec855 |
+ aio_context_release(ctx_a);
|
|
|
4ec855 |
+ aio_context_acquire(ctx_b);
|
|
|
4ec855 |
+ bdrv_set_aio_context(bs, qemu_get_aio_context());
|
|
|
4ec855 |
+ aio_context_release(ctx_b);
|
|
|
4ec855 |
+ bdrv_drained_end(bs);
|
|
|
4ec855 |
+
|
|
|
4ec855 |
+ bdrv_unref(bs);
|
|
|
4ec855 |
+ iothread_join(a);
|
|
|
4ec855 |
+ iothread_join(b);
|
|
|
4ec855 |
+}
|
|
|
4ec855 |
+
|
|
|
4ec855 |
int main(int argc, char **argv)
|
|
|
4ec855 |
{
|
|
|
4ec855 |
int ret;
|
|
|
4ec855 |
@@ -1602,6 +1632,8 @@ int main(int argc, char **argv)
|
|
|
4ec855 |
|
|
|
4ec855 |
g_test_add_func("/bdrv-drain/attach/drain", test_append_to_drained);
|
|
|
4ec855 |
|
|
|
4ec855 |
+ g_test_add_func("/bdrv-drain/set_aio_context", test_set_aio_context);
|
|
|
4ec855 |
+
|
|
|
4ec855 |
ret = g_test_run();
|
|
|
4ec855 |
qemu_event_destroy(&done_event);
|
|
|
4ec855 |
return ret;
|
|
|
4ec855 |
--
|
|
|
4ec855 |
1.8.3.1
|
|
|
4ec855 |
|