job: Add job_sleep_ns()

There is nothing block layer specific about block_job_sleep_ns(), so
move the function to Job.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
Kevin Wolf 2018-04-18 16:32:20 +02:00
parent da01ff7f38
commit 5d43e86e11
11 changed files with 61 additions and 50 deletions

View file

@ -508,7 +508,7 @@ static void coroutine_fn test_job_start(void *opaque)
block_job_event_ready(&s->common);
while (!s->should_complete) {
block_job_sleep_ns(&s->common, 100000);
job_sleep_ns(&s->common.job, 100000);
}
job_defer_to_main_loop(&s->common.job, test_job_completed, NULL);
@ -553,7 +553,7 @@ static void test_blockjob_common(enum drain_type drain_type)
g_assert_cmpint(job->job.pause_count, ==, 0);
g_assert_false(job->job.paused);
g_assert_false(job->job.busy); /* We're in block_job_sleep_ns() */
g_assert_false(job->job.busy); /* We're in job_sleep_ns() */
do_drain_begin(drain_type, src);
@ -571,7 +571,7 @@ static void test_blockjob_common(enum drain_type drain_type)
g_assert_cmpint(job->job.pause_count, ==, 0);
g_assert_false(job->job.paused);
g_assert_false(job->job.busy); /* We're in block_job_sleep_ns() */
g_assert_false(job->job.busy); /* We're in job_sleep_ns() */
do_drain_begin(drain_type, target);
@ -589,7 +589,7 @@ static void test_blockjob_common(enum drain_type drain_type)
g_assert_cmpint(job->job.pause_count, ==, 0);
g_assert_false(job->job.paused);
g_assert_false(job->job.busy); /* We're in block_job_sleep_ns() */
g_assert_false(job->job.busy); /* We're in job_sleep_ns() */
ret = block_job_complete_sync(job, &error_abort);
g_assert_cmpint(ret, ==, 0);