aboutsummaryrefslogtreecommitdiff
path: root/blockjob.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-04-18 16:32:20 +0200
committerKevin Wolf <kwolf@redhat.com>2018-05-23 14:30:50 +0200
commit5d43e86e11f488fda7956b13160e0c0105a84845 (patch)
treeb5c4200538b55bb476e92b197a352ea4e3c09ce0 /blockjob.c
parentda01ff7f38f52791f93fc3ca59afcfbb220f15af (diff)
downloadqemu-5d43e86e11f488fda7956b13160e0c0105a84845.zip
qemu-5d43e86e11f488fda7956b13160e0c0105a84845.tar.gz
qemu-5d43e86e11f488fda7956b13160e0c0105a84845.tar.bz2
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>
Diffstat (limited to 'blockjob.c')
-rw-r--r--blockjob.c27
1 files changed, 0 insertions, 27 deletions
diff --git a/blockjob.c b/blockjob.c
index 313b1ff..4dc360c 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -181,7 +181,6 @@ void block_job_free(Job *job)
block_job_detach_aio_context, bjob);
blk_unref(bjob->blk);
error_free(bjob->blocker);
- assert(!timer_pending(&bjob->job.sleep_timer));
}
static void block_job_attached_aio_context(AioContext *new_context,
@@ -290,13 +289,6 @@ const BlockJobDriver *block_job_driver(BlockJob *job)
return job->driver;
}
-static void block_job_sleep_timer_cb(void *opaque)
-{
- BlockJob *job = opaque;
-
- block_job_enter(job);
-}
-
static void block_job_decommission(BlockJob *job)
{
assert(job);
@@ -866,9 +858,6 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver,
job->opaque = opaque;
job->auto_finalize = !(flags & BLOCK_JOB_MANUAL_FINALIZE);
job->auto_dismiss = !(flags & BLOCK_JOB_MANUAL_DISMISS);
- aio_timer_init(qemu_get_aio_context(), &job->job.sleep_timer,
- QEMU_CLOCK_REALTIME, SCALE_NS,
- block_job_sleep_timer_cb, job);
error_setg(&job->blocker, "block device is in use by block job: %s",
job_type_str(&job->job));
@@ -931,22 +920,6 @@ void block_job_enter(BlockJob *job)
job_enter_cond(&job->job, NULL);
}
-void block_job_sleep_ns(BlockJob *job, int64_t ns)
-{
- assert(job->job.busy);
-
- /* Check cancellation *before* setting busy = false, too! */
- if (job_is_cancelled(&job->job)) {
- return;
- }
-
- if (!job_should_pause(&job->job)) {
- job_do_yield(&job->job, qemu_clock_get_ns(QEMU_CLOCK_REALTIME) + ns);
- }
-
- job_pause_point(&job->job);
-}
-
void block_job_yield(BlockJob *job)
{
assert(job->job.busy);