aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/test-block-iothread.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/test-block-iothread.c')
-rw-r--r--tests/unit/test-block-iothread.c31
1 files changed, 0 insertions, 31 deletions
diff --git a/tests/unit/test-block-iothread.c b/tests/unit/test-block-iothread.c
index 9b15d2768c..3766d5de6b 100644
--- a/tests/unit/test-block-iothread.c
+++ b/tests/unit/test-block-iothread.c
@@ -483,7 +483,6 @@ static void test_sync_op(const void *opaque)
bdrv_graph_rdunlock_main_loop();
blk_set_aio_context(blk, ctx, &error_abort);
- aio_context_acquire(ctx);
if (t->fn) {
t->fn(c);
}
@@ -491,7 +490,6 @@ static void test_sync_op(const void *opaque)
t->blkfn(blk);
}
blk_set_aio_context(blk, qemu_get_aio_context(), &error_abort);
- aio_context_release(ctx);
bdrv_unref(bs);
blk_unref(blk);
@@ -576,9 +574,7 @@ static void test_attach_blockjob(void)
aio_poll(qemu_get_aio_context(), false);
}
- aio_context_acquire(ctx);
blk_set_aio_context(blk, qemu_get_aio_context(), &error_abort);
- aio_context_release(ctx);
tjob->n = 0;
while (tjob->n == 0) {
@@ -595,9 +591,7 @@ static void test_attach_blockjob(void)
WITH_JOB_LOCK_GUARD() {
job_complete_sync_locked(&tjob->common.job, &error_abort);
}
- aio_context_acquire(ctx);
blk_set_aio_context(blk, qemu_get_aio_context(), &error_abort);
- aio_context_release(ctx);
bdrv_unref(bs);
blk_unref(blk);
@@ -654,9 +648,7 @@ static void test_propagate_basic(void)
/* Switch the AioContext back */
main_ctx = qemu_get_aio_context();
- aio_context_acquire(ctx);
blk_set_aio_context(blk, main_ctx, &error_abort);
- aio_context_release(ctx);
g_assert(blk_get_aio_context(blk) == main_ctx);
g_assert(bdrv_get_aio_context(bs_a) == main_ctx);
g_assert(bdrv_get_aio_context(bs_verify) == main_ctx);
@@ -732,9 +724,7 @@ static void test_propagate_diamond(void)
/* Switch the AioContext back */
main_ctx = qemu_get_aio_context();
- aio_context_acquire(ctx);
blk_set_aio_context(blk, main_ctx, &error_abort);
- aio_context_release(ctx);
g_assert(blk_get_aio_context(blk) == main_ctx);
g_assert(bdrv_get_aio_context(bs_verify) == main_ctx);
g_assert(bdrv_get_aio_context(bs_a) == main_ctx);
@@ -764,13 +754,11 @@ static void test_propagate_mirror(void)
&error_abort);
/* Start a mirror job */
- aio_context_acquire(main_ctx);
mirror_start("job0", src, target, NULL, JOB_DEFAULT, 0, 0, 0,
MIRROR_SYNC_MODE_NONE, MIRROR_OPEN_BACKING_CHAIN, false,
BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
false, "filter_node", MIRROR_COPY_MODE_BACKGROUND,
&error_abort);
- aio_context_release(main_ctx);
WITH_JOB_LOCK_GUARD() {
job = job_get_locked("job0");
@@ -785,9 +773,7 @@ static void test_propagate_mirror(void)
g_assert(job->aio_context == ctx);
/* Change the AioContext of target */
- aio_context_acquire(ctx);
bdrv_try_change_aio_context(target, main_ctx, NULL, &error_abort);
- aio_context_release(ctx);
g_assert(bdrv_get_aio_context(src) == main_ctx);
g_assert(bdrv_get_aio_context(target) == main_ctx);
g_assert(bdrv_get_aio_context(filter) == main_ctx);
@@ -805,10 +791,8 @@ static void test_propagate_mirror(void)
g_assert(bdrv_get_aio_context(filter) == main_ctx);
/* ...unless we explicitly allow it */
- aio_context_acquire(ctx);
blk_set_allow_aio_context_change(blk, true);
bdrv_try_change_aio_context(target, ctx, NULL, &error_abort);
- aio_context_release(ctx);
g_assert(blk_get_aio_context(blk) == ctx);
g_assert(bdrv_get_aio_context(src) == ctx);
@@ -817,10 +801,8 @@ static void test_propagate_mirror(void)
job_cancel_sync_all();
- aio_context_acquire(ctx);
blk_set_aio_context(blk, main_ctx, &error_abort);
bdrv_try_change_aio_context(target, main_ctx, NULL, &error_abort);
- aio_context_release(ctx);
blk_unref(blk);
bdrv_unref(src);
@@ -836,7 +818,6 @@ static void test_attach_second_node(void)
BlockDriverState *bs, *filter;
QDict *options;
- aio_context_acquire(main_ctx);
blk = blk_new(ctx, BLK_PERM_ALL, BLK_PERM_ALL);
bs = bdrv_new_open_driver(&bdrv_test, "base", BDRV_O_RDWR, &error_abort);
blk_insert_bs(blk, bs, &error_abort);
@@ -846,15 +827,12 @@ static void test_attach_second_node(void)
qdict_put_str(options, "file", "base");
filter = bdrv_open(NULL, NULL, options, BDRV_O_RDWR, &error_abort);
- aio_context_release(main_ctx);
g_assert(blk_get_aio_context(blk) == ctx);
g_assert(bdrv_get_aio_context(bs) == ctx);
g_assert(bdrv_get_aio_context(filter) == ctx);
- aio_context_acquire(ctx);
blk_set_aio_context(blk, main_ctx, &error_abort);
- aio_context_release(ctx);
g_assert(blk_get_aio_context(blk) == main_ctx);
g_assert(bdrv_get_aio_context(bs) == main_ctx);
g_assert(bdrv_get_aio_context(filter) == main_ctx);
@@ -868,11 +846,9 @@ static void test_attach_preserve_blk_ctx(void)
{
IOThread *iothread = iothread_new();
AioContext *ctx = iothread_get_aio_context(iothread);
- AioContext *main_ctx = qemu_get_aio_context();
BlockBackend *blk;
BlockDriverState *bs;
- aio_context_acquire(main_ctx);
blk = blk_new(ctx, BLK_PERM_ALL, BLK_PERM_ALL);
bs = bdrv_new_open_driver(&bdrv_test, "base", BDRV_O_RDWR, &error_abort);
bs->total_sectors = 65536 / BDRV_SECTOR_SIZE;
@@ -881,25 +857,18 @@ static void test_attach_preserve_blk_ctx(void)
blk_insert_bs(blk, bs, &error_abort);
g_assert(blk_get_aio_context(blk) == ctx);
g_assert(bdrv_get_aio_context(bs) == ctx);
- aio_context_release(main_ctx);
/* Remove the node again */
- aio_context_acquire(ctx);
blk_remove_bs(blk);
- aio_context_release(ctx);
g_assert(blk_get_aio_context(blk) == ctx);
g_assert(bdrv_get_aio_context(bs) == qemu_get_aio_context());
/* Re-attach the node */
- aio_context_acquire(main_ctx);
blk_insert_bs(blk, bs, &error_abort);
- aio_context_release(main_ctx);
g_assert(blk_get_aio_context(blk) == ctx);
g_assert(bdrv_get_aio_context(bs) == ctx);
- aio_context_acquire(ctx);
blk_set_aio_context(blk, qemu_get_aio_context(), &error_abort);
- aio_context_release(ctx);
bdrv_unref(bs);
blk_unref(blk);
}