|
|
383d26 |
From ed61540140ae22f897f15846a359dc11a0a0b027 Mon Sep 17 00:00:00 2001
|
|
|
383d26 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
383d26 |
Date: Fri, 1 Mar 2019 14:27:46 +0100
|
|
|
383d26 |
Subject: [PATCH 4/9] test-bdrv-drain: AioContext switch in drained section
|
|
|
383d26 |
|
|
|
383d26 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
383d26 |
Message-id: <20190301142747.12251-5-kwolf@redhat.com>
|
|
|
383d26 |
Patchwork-id: 84766
|
|
|
383d26 |
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 4/5] test-bdrv-drain: AioContext switch in drained section
|
|
|
383d26 |
Bugzilla: 1671173
|
|
|
383d26 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
383d26 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
383d26 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
383d26 |
|
|
|
383d26 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
383d26 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
383d26 |
(cherry picked from commit 247d2737715833525725d27e5cecf5840c62f900)
|
|
|
383d26 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
383d26 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
383d26 |
---
|
|
|
383d26 |
tests/test-bdrv-drain.c | 32 ++++++++++++++++++++++++++++++++
|
|
|
383d26 |
1 file changed, 32 insertions(+)
|
|
|
383d26 |
|
|
|
383d26 |
diff --git a/tests/test-bdrv-drain.c b/tests/test-bdrv-drain.c
|
|
|
383d26 |
index 8641b54..05c6f12 100644
|
|
|
383d26 |
--- a/tests/test-bdrv-drain.c
|
|
|
383d26 |
+++ b/tests/test-bdrv-drain.c
|
|
|
383d26 |
@@ -1521,6 +1521,36 @@ static void test_append_to_drained(void)
|
|
|
383d26 |
blk_unref(blk);
|
|
|
383d26 |
}
|
|
|
383d26 |
|
|
|
383d26 |
+static void test_set_aio_context(void)
|
|
|
383d26 |
+{
|
|
|
383d26 |
+ BlockDriverState *bs;
|
|
|
383d26 |
+ IOThread *a = iothread_new();
|
|
|
383d26 |
+ IOThread *b = iothread_new();
|
|
|
383d26 |
+ AioContext *ctx_a = iothread_get_aio_context(a);
|
|
|
383d26 |
+ AioContext *ctx_b = iothread_get_aio_context(b);
|
|
|
383d26 |
+
|
|
|
383d26 |
+ bs = bdrv_new_open_driver(&bdrv_test, "test-node", BDRV_O_RDWR,
|
|
|
383d26 |
+ &error_abort);
|
|
|
383d26 |
+
|
|
|
383d26 |
+ bdrv_drained_begin(bs);
|
|
|
383d26 |
+ bdrv_set_aio_context(bs, ctx_a);
|
|
|
383d26 |
+
|
|
|
383d26 |
+ aio_context_acquire(ctx_a);
|
|
|
383d26 |
+ bdrv_drained_end(bs);
|
|
|
383d26 |
+
|
|
|
383d26 |
+ bdrv_drained_begin(bs);
|
|
|
383d26 |
+ bdrv_set_aio_context(bs, ctx_b);
|
|
|
383d26 |
+ aio_context_release(ctx_a);
|
|
|
383d26 |
+ aio_context_acquire(ctx_b);
|
|
|
383d26 |
+ bdrv_set_aio_context(bs, qemu_get_aio_context());
|
|
|
383d26 |
+ aio_context_release(ctx_b);
|
|
|
383d26 |
+ bdrv_drained_end(bs);
|
|
|
383d26 |
+
|
|
|
383d26 |
+ bdrv_unref(bs);
|
|
|
383d26 |
+ iothread_join(a);
|
|
|
383d26 |
+ iothread_join(b);
|
|
|
383d26 |
+}
|
|
|
383d26 |
+
|
|
|
383d26 |
int main(int argc, char **argv)
|
|
|
383d26 |
{
|
|
|
383d26 |
int ret;
|
|
|
383d26 |
@@ -1602,6 +1632,8 @@ int main(int argc, char **argv)
|
|
|
383d26 |
|
|
|
383d26 |
g_test_add_func("/bdrv-drain/attach/drain", test_append_to_drained);
|
|
|
383d26 |
|
|
|
383d26 |
+ g_test_add_func("/bdrv-drain/set_aio_context", test_set_aio_context);
|
|
|
383d26 |
+
|
|
|
383d26 |
ret = g_test_run();
|
|
|
383d26 |
qemu_event_destroy(&done_event);
|
|
|
383d26 |
return ret;
|
|
|
383d26 |
--
|
|
|
383d26 |
1.8.3.1
|
|
|
383d26 |
|