From eb23654dbe43b549ea2a9ebff9d8edf544d34a73 Mon Sep 17 00:00:00 2001 From: John Snow Date: Wed, 29 Aug 2018 21:57:31 -0400 Subject: jobs: utilize job_exit shim Utilize the job_exit shim by not calling job_defer_to_main_loop, and where applicable, converting the deferred callback into the job_exit callback. This converts backup, stream, create, and the unit tests all at once. Most of these jobs do not see any changes to the order in which they clean up their resources, except the test-blockjob-txn test, which now puts down its bs before job_completed is called. This is safe for the same reason the reordering in the mirror job is safe, because job_completed no longer runs under two locks, making the unref safe even if it causes a flush. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20180830015734.19765-7-jsnow@redhat.com Signed-off-by: Max Reitz --- tests/test-bdrv-drain.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'tests/test-bdrv-drain.c') diff --git a/tests/test-bdrv-drain.c b/tests/test-bdrv-drain.c index 6bda4451c1..89ac15e88a 100644 --- a/tests/test-bdrv-drain.c +++ b/tests/test-bdrv-drain.c @@ -752,11 +752,6 @@ typedef struct TestBlockJob { bool should_complete; } TestBlockJob; -static void test_job_completed(Job *job, void *opaque) -{ - job_completed(job, 0); -} - static int coroutine_fn test_job_run(Job *job, Error **errp) { TestBlockJob *s = container_of(job, TestBlockJob, common.job); @@ -770,7 +765,6 @@ static int coroutine_fn test_job_run(Job *job, Error **errp) job_pause_point(&s->common.job); } - job_defer_to_main_loop(&s->common.job, test_job_completed, NULL); return 0; } -- cgit v1.2.3