Blame SOURCES/kvm-job-Move-pause-resume-functions-to-Job.patch

1bdc94
From 6e9a5d0ef7ada1b153e0808c0fe73eeab940cfbd Mon Sep 17 00:00:00 2001
1bdc94
From: Kevin Wolf <kwolf@redhat.com>
1bdc94
Date: Tue, 26 Jun 2018 09:48:11 +0200
1bdc94
Subject: [PATCH 42/89] job: Move pause/resume functions to Job
1bdc94
1bdc94
RH-Author: Kevin Wolf <kwolf@redhat.com>
1bdc94
Message-id: <20180626094856.6924-29-kwolf@redhat.com>
1bdc94
Patchwork-id: 81062
1bdc94
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH v2 28/73] job: Move pause/resume functions to Job
1bdc94
Bugzilla: 1513543
1bdc94
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
1bdc94
RH-Acked-by: Max Reitz <mreitz@redhat.com>
1bdc94
RH-Acked-by: Fam Zheng <famz@redhat.com>
1bdc94
1bdc94
While we already moved the state related to job pausing to Job, the
1bdc94
functions to do were still BlockJob only. This commit moves them over to
1bdc94
Job.
1bdc94
1bdc94
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
1bdc94
Reviewed-by: Max Reitz <mreitz@redhat.com>
1bdc94
Reviewed-by: John Snow <jsnow@redhat.com>
1bdc94
(cherry picked from commit b15de82867975e0b4acf644b5ee36d84904b6612)
1bdc94
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
1bdc94
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
1bdc94
---
1bdc94
 block/backup.c               |  1 +
1bdc94
 block/commit.c               |  1 +
1bdc94
 block/mirror.c               |  2 ++
1bdc94
 block/stream.c               |  1 +
1bdc94
 blockdev.c                   |  6 ++--
1bdc94
 blockjob.c                   | 81 +++++++++-----------------------------------
1bdc94
 include/block/blockjob.h     | 32 -----------------
1bdc94
 include/block/blockjob_int.h |  7 ++++
1bdc94
 include/qemu/job.h           | 37 ++++++++++++++++++++
1bdc94
 job.c                        | 59 ++++++++++++++++++++++++++++++++
1bdc94
 tests/test-bdrv-drain.c      |  1 +
1bdc94
 tests/test-blockjob-txn.c    |  1 +
1bdc94
 tests/test-blockjob.c        |  6 ++--
1bdc94
 13 files changed, 133 insertions(+), 102 deletions(-)
1bdc94
1bdc94
diff --git a/block/backup.c b/block/backup.c
1bdc94
index f3a4f7c..4d011d5 100644
1bdc94
--- a/block/backup.c
1bdc94
+++ b/block/backup.c
1bdc94
@@ -528,6 +528,7 @@ static const BlockJobDriver backup_job_driver = {
1bdc94
         .instance_size          = sizeof(BackupBlockJob),
1bdc94
         .job_type               = JOB_TYPE_BACKUP,
1bdc94
         .free                   = block_job_free,
1bdc94
+        .user_resume            = block_job_user_resume,
1bdc94
         .start                  = backup_run,
1bdc94
     },
1bdc94
     .commit                 = backup_commit,
1bdc94
diff --git a/block/commit.c b/block/commit.c
1bdc94
index 1c6cb6c..c4a98e5 100644
1bdc94
--- a/block/commit.c
1bdc94
+++ b/block/commit.c
1bdc94
@@ -220,6 +220,7 @@ static const BlockJobDriver commit_job_driver = {
1bdc94
         .instance_size = sizeof(CommitBlockJob),
1bdc94
         .job_type      = JOB_TYPE_COMMIT,
1bdc94
         .free          = block_job_free,
1bdc94
+        .user_resume   = block_job_user_resume,
1bdc94
         .start         = commit_run,
1bdc94
     },
1bdc94
 };
1bdc94
diff --git a/block/mirror.c b/block/mirror.c
1bdc94
index 5d8f75c..9a7226f 100644
1bdc94
--- a/block/mirror.c
1bdc94
+++ b/block/mirror.c
1bdc94
@@ -991,6 +991,7 @@ static const BlockJobDriver mirror_job_driver = {
1bdc94
         .instance_size          = sizeof(MirrorBlockJob),
1bdc94
         .job_type               = JOB_TYPE_MIRROR,
1bdc94
         .free                   = block_job_free,
1bdc94
+        .user_resume            = block_job_user_resume,
1bdc94
         .start                  = mirror_run,
1bdc94
         .pause                  = mirror_pause,
1bdc94
     },
1bdc94
@@ -1004,6 +1005,7 @@ static const BlockJobDriver commit_active_job_driver = {
1bdc94
         .instance_size          = sizeof(MirrorBlockJob),
1bdc94
         .job_type               = JOB_TYPE_COMMIT,
1bdc94
         .free                   = block_job_free,
1bdc94
+        .user_resume            = block_job_user_resume,
1bdc94
         .start                  = mirror_run,
1bdc94
         .pause                  = mirror_pause,
1bdc94
     },
1bdc94
diff --git a/block/stream.c b/block/stream.c
1bdc94
index 1faab02..e81b488 100644
1bdc94
--- a/block/stream.c
1bdc94
+++ b/block/stream.c
1bdc94
@@ -214,6 +214,7 @@ static const BlockJobDriver stream_job_driver = {
1bdc94
         .job_type      = JOB_TYPE_STREAM,
1bdc94
         .free          = block_job_free,
1bdc94
         .start         = stream_run,
1bdc94
+        .user_resume   = block_job_user_resume,
1bdc94
     },
1bdc94
 };
1bdc94
 
1bdc94
diff --git a/blockdev.c b/blockdev.c
1bdc94
index efb83c4..0fa1990 100644
1bdc94
--- a/blockdev.c
1bdc94
+++ b/blockdev.c
1bdc94
@@ -3891,7 +3891,7 @@ void qmp_block_job_cancel(const char *device,
1bdc94
         force = false;
1bdc94
     }
1bdc94
 
1bdc94
-    if (block_job_user_paused(job) && !force) {
1bdc94
+    if (job_user_paused(&job->job) && !force) {
1bdc94
         error_setg(errp, "The block job for device '%s' is currently paused",
1bdc94
                    device);
1bdc94
         goto out;
1bdc94
@@ -3913,7 +3913,7 @@ void qmp_block_job_pause(const char *device, Error **errp)
1bdc94
     }
1bdc94
 
1bdc94
     trace_qmp_block_job_pause(job);
1bdc94
-    block_job_user_pause(job, errp);
1bdc94
+    job_user_pause(&job->job, errp);
1bdc94
     aio_context_release(aio_context);
1bdc94
 }
1bdc94
 
1bdc94
@@ -3927,7 +3927,7 @@ void qmp_block_job_resume(const char *device, Error **errp)
1bdc94
     }
1bdc94
 
1bdc94
     trace_qmp_block_job_resume(job);
1bdc94
-    block_job_user_resume(job, errp);
1bdc94
+    job_user_resume(&job->job, errp);
1bdc94
     aio_context_release(aio_context);
1bdc94
 }
1bdc94
 
1bdc94
diff --git a/blockjob.c b/blockjob.c
1bdc94
index 4dc360c..6334a54 100644
1bdc94
--- a/blockjob.c
1bdc94
+++ b/blockjob.c
1bdc94
@@ -140,29 +140,6 @@ static void block_job_txn_del_job(BlockJob *job)
1bdc94
     }
1bdc94
 }
1bdc94
 
1bdc94
-/* Assumes the job_mutex is held */
1bdc94
-static bool job_timer_not_pending(Job *job)
1bdc94
-{
1bdc94
-    return !timer_pending(&job->sleep_timer);
1bdc94
-}
1bdc94
-
1bdc94
-static void block_job_pause(BlockJob *job)
1bdc94
-{
1bdc94
-    job->job.pause_count++;
1bdc94
-}
1bdc94
-
1bdc94
-static void block_job_resume(BlockJob *job)
1bdc94
-{
1bdc94
-    assert(job->job.pause_count > 0);
1bdc94
-    job->job.pause_count--;
1bdc94
-    if (job->job.pause_count) {
1bdc94
-        return;
1bdc94
-    }
1bdc94
-
1bdc94
-    /* kick only if no timer is pending */
1bdc94
-    job_enter_cond(&job->job, job_timer_not_pending);
1bdc94
-}
1bdc94
-
1bdc94
 static void block_job_attached_aio_context(AioContext *new_context,
1bdc94
                                            void *opaque);
1bdc94
 static void block_job_detach_aio_context(void *opaque);
1bdc94
@@ -193,7 +170,7 @@ static void block_job_attached_aio_context(AioContext *new_context,
1bdc94
         job->driver->attached_aio_context(job, new_context);
1bdc94
     }
1bdc94
 
1bdc94
-    block_job_resume(job);
1bdc94
+    job_resume(&job->job);
1bdc94
 }
1bdc94
 
1bdc94
 static void block_job_drain(BlockJob *job)
1bdc94
@@ -214,7 +191,7 @@ static void block_job_detach_aio_context(void *opaque)
1bdc94
     /* In case the job terminates during aio_poll()... */
1bdc94
     job_ref(&job->job);
1bdc94
 
1bdc94
-    block_job_pause(job);
1bdc94
+    job_pause(&job->job);
1bdc94
 
1bdc94
     while (!job->job.paused && !job->completed) {
1bdc94
         block_job_drain(job);
1bdc94
@@ -233,13 +210,13 @@ static char *child_job_get_parent_desc(BdrvChild *c)
1bdc94
 static void child_job_drained_begin(BdrvChild *c)
1bdc94
 {
1bdc94
     BlockJob *job = c->opaque;
1bdc94
-    block_job_pause(job);
1bdc94
+    job_pause(&job->job);
1bdc94
 }
1bdc94
 
1bdc94
 static void child_job_drained_end(BdrvChild *c)
1bdc94
 {
1bdc94
     BlockJob *job = c->opaque;
1bdc94
-    block_job_resume(job);
1bdc94
+    job_resume(&job->job);
1bdc94
 }
1bdc94
 
1bdc94
 static const BdrvChildRole child_job = {
1bdc94
@@ -396,9 +373,9 @@ static void block_job_cancel_async(BlockJob *job, bool force)
1bdc94
     if (job->iostatus != BLOCK_DEVICE_IO_STATUS_OK) {
1bdc94
         block_job_iostatus_reset(job);
1bdc94
     }
1bdc94
-    if (job->user_paused) {
1bdc94
+    if (job->job.user_paused) {
1bdc94
         /* Do not call block_job_enter here, the caller will handle it.  */
1bdc94
-        job->user_paused = false;
1bdc94
+        job->job.user_paused = false;
1bdc94
         job->job.pause_count--;
1bdc94
     }
1bdc94
     job->job.cancelled = true;
1bdc94
@@ -628,39 +605,6 @@ void block_job_dismiss(BlockJob **jobptr, Error **errp)
1bdc94
     *jobptr = NULL;
1bdc94
 }
1bdc94
 
1bdc94
-void block_job_user_pause(BlockJob *job, Error **errp)
1bdc94
-{
1bdc94
-    if (job_apply_verb(&job->job, JOB_VERB_PAUSE, errp)) {
1bdc94
-        return;
1bdc94
-    }
1bdc94
-    if (job->user_paused) {
1bdc94
-        error_setg(errp, "Job is already paused");
1bdc94
-        return;
1bdc94
-    }
1bdc94
-    job->user_paused = true;
1bdc94
-    block_job_pause(job);
1bdc94
-}
1bdc94
-
1bdc94
-bool block_job_user_paused(BlockJob *job)
1bdc94
-{
1bdc94
-    return job->user_paused;
1bdc94
-}
1bdc94
-
1bdc94
-void block_job_user_resume(BlockJob *job, Error **errp)
1bdc94
-{
1bdc94
-    assert(job);
1bdc94
-    if (!job->user_paused || job->job.pause_count <= 0) {
1bdc94
-        error_setg(errp, "Can't resume a job that was not paused");
1bdc94
-        return;
1bdc94
-    }
1bdc94
-    if (job_apply_verb(&job->job, JOB_VERB_RESUME, errp)) {
1bdc94
-        return;
1bdc94
-    }
1bdc94
-    block_job_iostatus_reset(job);
1bdc94
-    job->user_paused = false;
1bdc94
-    block_job_resume(job);
1bdc94
-}
1bdc94
-
1bdc94
 void block_job_cancel(BlockJob *job, bool force)
1bdc94
 {
1bdc94
     if (job->job.status == JOB_STATUS_CONCLUDED) {
1bdc94
@@ -851,6 +795,7 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver,
1bdc94
 
1bdc94
     assert(is_block_job(&job->job));
1bdc94
     assert(job->job.driver->free == &block_job_free);
1bdc94
+    assert(job->job.driver->user_resume == &block_job_user_resume);
1bdc94
 
1bdc94
     job->driver        = driver;
1bdc94
     job->blk           = blk;
1bdc94
@@ -941,10 +886,16 @@ void block_job_iostatus_reset(BlockJob *job)
1bdc94
     if (job->iostatus == BLOCK_DEVICE_IO_STATUS_OK) {
1bdc94
         return;
1bdc94
     }
1bdc94
-    assert(job->user_paused && job->job.pause_count > 0);
1bdc94
+    assert(job->job.user_paused && job->job.pause_count > 0);
1bdc94
     job->iostatus = BLOCK_DEVICE_IO_STATUS_OK;
1bdc94
 }
1bdc94
 
1bdc94
+void block_job_user_resume(Job *job)
1bdc94
+{
1bdc94
+    BlockJob *bjob = container_of(job, BlockJob, job);
1bdc94
+    block_job_iostatus_reset(bjob);
1bdc94
+}
1bdc94
+
1bdc94
 void block_job_event_ready(BlockJob *job)
1bdc94
 {
1bdc94
     job_state_transition(&job->job, JOB_STATUS_READY);
1bdc94
@@ -991,9 +942,9 @@ BlockErrorAction block_job_error_action(BlockJob *job, BlockdevOnError on_err,
1bdc94
                                         action, &error_abort);
1bdc94
     }
1bdc94
     if (action == BLOCK_ERROR_ACTION_STOP) {
1bdc94
-        block_job_pause(job);
1bdc94
+        job_pause(&job->job);
1bdc94
         /* make the pause user visible, which will be resumed from QMP. */
1bdc94
-        job->user_paused = true;
1bdc94
+        job->job.user_paused = true;
1bdc94
         block_job_iostatus_set_err(job, error);
1bdc94
     }
1bdc94
     return action;
1bdc94
diff --git a/include/block/blockjob.h b/include/block/blockjob.h
1bdc94
index b60d919..556a8f6 100644
1bdc94
--- a/include/block/blockjob.h
1bdc94
+++ b/include/block/blockjob.h
1bdc94
@@ -57,12 +57,6 @@ typedef struct BlockJob {
1bdc94
     bool force;
1bdc94
 
1bdc94
     /**
1bdc94
-     * Set to true if the job is paused by user.  Can be unpaused with the
1bdc94
-     * block-job-resume QMP command.
1bdc94
-     */
1bdc94
-    bool user_paused;
1bdc94
-
1bdc94
-    /**
1bdc94
      * Set to true when the job is ready to be completed.
1bdc94
      */
1bdc94
     bool ready;
1bdc94
@@ -248,32 +242,6 @@ void block_job_progress_set_remaining(BlockJob *job, uint64_t remaining);
1bdc94
 BlockJobInfo *block_job_query(BlockJob *job, Error **errp);
1bdc94
 
1bdc94
 /**
1bdc94
- * block_job_user_pause:
1bdc94
- * @job: The job to be paused.
1bdc94
- *
1bdc94
- * Asynchronously pause the specified job.
1bdc94
- * Do not allow a resume until a matching call to block_job_user_resume.
1bdc94
- */
1bdc94
-void block_job_user_pause(BlockJob *job, Error **errp);
1bdc94
-
1bdc94
-/**
1bdc94
- * block_job_paused:
1bdc94
- * @job: The job to query.
1bdc94
- *
1bdc94
- * Returns true if the job is user-paused.
1bdc94
- */
1bdc94
-bool block_job_user_paused(BlockJob *job);
1bdc94
-
1bdc94
-/**
1bdc94
- * block_job_user_resume:
1bdc94
- * @job: The job to be resumed.
1bdc94
- *
1bdc94
- * Resume the specified job.
1bdc94
- * Must be paired with a preceding block_job_user_pause.
1bdc94
- */
1bdc94
-void block_job_user_resume(BlockJob *job, Error **errp);
1bdc94
-
1bdc94
-/**
1bdc94
  * block_job_user_cancel:
1bdc94
  * @job: The job to be cancelled.
1bdc94
  * @force: Quit a job without waiting for data to be in sync.
1bdc94
diff --git a/include/block/blockjob_int.h b/include/block/blockjob_int.h
1bdc94
index 8937f5b..7e705ae 100644
1bdc94
--- a/include/block/blockjob_int.h
1bdc94
+++ b/include/block/blockjob_int.h
1bdc94
@@ -134,6 +134,13 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver,
1bdc94
 void block_job_free(Job *job);
1bdc94
 
1bdc94
 /**
1bdc94
+ * block_job_user_resume:
1bdc94
+ * Callback to be used for JobDriver.user_resume in all block jobs. Resets the
1bdc94
+ * iostatus when the user resumes @job.
1bdc94
+ */
1bdc94
+void block_job_user_resume(Job *job);
1bdc94
+
1bdc94
+/**
1bdc94
  * block_job_yield:
1bdc94
  * @job: The job that calls the function.
1bdc94
  *
1bdc94
diff --git a/include/qemu/job.h b/include/qemu/job.h
1bdc94
index 509408f..bc63985 100644
1bdc94
--- a/include/qemu/job.h
1bdc94
+++ b/include/qemu/job.h
1bdc94
@@ -83,6 +83,12 @@ typedef struct Job {
1bdc94
     bool paused;
1bdc94
 
1bdc94
     /**
1bdc94
+     * Set to true if the job is paused by user.  Can be unpaused with the
1bdc94
+     * block-job-resume QMP command.
1bdc94
+     */
1bdc94
+    bool user_paused;
1bdc94
+
1bdc94
+    /**
1bdc94
      * Set to true if the job should cancel itself.  The flag must
1bdc94
      * always be tested just before toggling the busy flag from false
1bdc94
      * to true.  After a job has been cancelled, it should only yield
1bdc94
@@ -124,6 +130,12 @@ struct JobDriver {
1bdc94
      */
1bdc94
     void coroutine_fn (*resume)(Job *job);
1bdc94
 
1bdc94
+    /**
1bdc94
+     * Called when the job is resumed by the user (i.e. user_paused becomes
1bdc94
+     * false). .user_resume is called before .resume.
1bdc94
+     */
1bdc94
+    void (*user_resume)(Job *job);
1bdc94
+
1bdc94
     /** Called when the job is freed */
1bdc94
     void (*free)(Job *job);
1bdc94
 };
1bdc94
@@ -203,6 +215,31 @@ const char *job_type_str(const Job *job);
1bdc94
 bool job_is_cancelled(Job *job);
1bdc94
 
1bdc94
 /**
1bdc94
+ * Request @job to pause at the next pause point. Must be paired with
1bdc94
+ * job_resume(). If the job is supposed to be resumed by user action, call
1bdc94
+ * job_user_pause() instead.
1bdc94
+ */
1bdc94
+void job_pause(Job *job);
1bdc94
+
1bdc94
+/** Resumes a @job paused with job_pause. */
1bdc94
+void job_resume(Job *job);
1bdc94
+
1bdc94
+/**
1bdc94
+ * Asynchronously pause the specified @job.
1bdc94
+ * Do not allow a resume until a matching call to job_user_resume.
1bdc94
+ */
1bdc94
+void job_user_pause(Job *job, Error **errp);
1bdc94
+
1bdc94
+/** Returns true if the job is user-paused. */
1bdc94
+bool job_user_paused(Job *job);
1bdc94
+
1bdc94
+/**
1bdc94
+ * Resume the specified @job.
1bdc94
+ * Must be paired with a preceding job_user_pause.
1bdc94
+ */
1bdc94
+void job_user_resume(Job *job, Error **errp);
1bdc94
+
1bdc94
+/**
1bdc94
  * Get the next element from the list of block jobs after @job, or the
1bdc94
  * first one if @job is %NULL.
1bdc94
  *
1bdc94
diff --git a/job.c b/job.c
1bdc94
index 1b8cba1..fd10b1d 100644
1bdc94
--- a/job.c
1bdc94
+++ b/job.c
1bdc94
@@ -341,6 +341,65 @@ void job_start(Job *job)
1bdc94
     aio_co_enter(job->aio_context, job->co);
1bdc94
 }
1bdc94
 
1bdc94
+/* Assumes the block_job_mutex is held */
1bdc94
+static bool job_timer_not_pending(Job *job)
1bdc94
+{
1bdc94
+    return !timer_pending(&job->sleep_timer);
1bdc94
+}
1bdc94
+
1bdc94
+void job_pause(Job *job)
1bdc94
+{
1bdc94
+    job->pause_count++;
1bdc94
+}
1bdc94
+
1bdc94
+void job_resume(Job *job)
1bdc94
+{
1bdc94
+    assert(job->pause_count > 0);
1bdc94
+    job->pause_count--;
1bdc94
+    if (job->pause_count) {
1bdc94
+        return;
1bdc94
+    }
1bdc94
+
1bdc94
+    /* kick only if no timer is pending */
1bdc94
+    job_enter_cond(job, job_timer_not_pending);
1bdc94
+}
1bdc94
+
1bdc94
+void job_user_pause(Job *job, Error **errp)
1bdc94
+{
1bdc94
+    if (job_apply_verb(job, JOB_VERB_PAUSE, errp)) {
1bdc94
+        return;
1bdc94
+    }
1bdc94
+    if (job->user_paused) {
1bdc94
+        error_setg(errp, "Job is already paused");
1bdc94
+        return;
1bdc94
+    }
1bdc94
+    job->user_paused = true;
1bdc94
+    job_pause(job);
1bdc94
+}
1bdc94
+
1bdc94
+bool job_user_paused(Job *job)
1bdc94
+{
1bdc94
+    return job->user_paused;
1bdc94
+}
1bdc94
+
1bdc94
+void job_user_resume(Job *job, Error **errp)
1bdc94
+{
1bdc94
+    assert(job);
1bdc94
+    if (!job->user_paused || job->pause_count <= 0) {
1bdc94
+        error_setg(errp, "Can't resume a job that was not paused");
1bdc94
+        return;
1bdc94
+    }
1bdc94
+    if (job_apply_verb(job, JOB_VERB_RESUME, errp)) {
1bdc94
+        return;
1bdc94
+    }
1bdc94
+    if (job->driver->user_resume) {
1bdc94
+        job->driver->user_resume(job);
1bdc94
+    }
1bdc94
+    job->user_paused = false;
1bdc94
+    job_resume(job);
1bdc94
+}
1bdc94
+
1bdc94
+
1bdc94
 typedef struct {
1bdc94
     Job *job;
1bdc94
     JobDeferToMainLoopFn *fn;
1bdc94
diff --git a/tests/test-bdrv-drain.c b/tests/test-bdrv-drain.c
1bdc94
index 50232f5..c993512 100644
1bdc94
--- a/tests/test-bdrv-drain.c
1bdc94
+++ b/tests/test-bdrv-drain.c
1bdc94
@@ -524,6 +524,7 @@ BlockJobDriver test_job_driver = {
1bdc94
     .job_driver = {
1bdc94
         .instance_size  = sizeof(TestBlockJob),
1bdc94
         .free           = block_job_free,
1bdc94
+        .user_resume    = block_job_user_resume,
1bdc94
         .start          = test_job_start,
1bdc94
     },
1bdc94
     .complete       = test_job_complete,
1bdc94
diff --git a/tests/test-blockjob-txn.c b/tests/test-blockjob-txn.c
1bdc94
index 0e6162b..93d1ff0 100644
1bdc94
--- a/tests/test-blockjob-txn.c
1bdc94
+++ b/tests/test-blockjob-txn.c
1bdc94
@@ -78,6 +78,7 @@ static const BlockJobDriver test_block_job_driver = {
1bdc94
     .job_driver = {
1bdc94
         .instance_size = sizeof(TestBlockJob),
1bdc94
         .free          = block_job_free,
1bdc94
+        .user_resume   = block_job_user_resume,
1bdc94
         .start         = test_block_job_run,
1bdc94
     },
1bdc94
 };
1bdc94
diff --git a/tests/test-blockjob.c b/tests/test-blockjob.c
1bdc94
index b329bd5..ceb5960 100644
1bdc94
--- a/tests/test-blockjob.c
1bdc94
+++ b/tests/test-blockjob.c
1bdc94
@@ -20,6 +20,7 @@ static const BlockJobDriver test_block_job_driver = {
1bdc94
     .job_driver = {
1bdc94
         .instance_size = sizeof(BlockJob),
1bdc94
         .free          = block_job_free,
1bdc94
+        .user_resume   = block_job_user_resume,
1bdc94
     },
1bdc94
 };
1bdc94
 
1bdc94
@@ -199,6 +200,7 @@ static const BlockJobDriver test_cancel_driver = {
1bdc94
     .job_driver = {
1bdc94
         .instance_size = sizeof(CancelJob),
1bdc94
         .free          = block_job_free,
1bdc94
+        .user_resume   = block_job_user_resume,
1bdc94
         .start         = cancel_job_start,
1bdc94
     },
1bdc94
     .complete      = cancel_job_complete,
1bdc94
@@ -270,7 +272,7 @@ static void test_cancel_paused(void)
1bdc94
     job_start(&job->job);
1bdc94
     assert(job->job.status == JOB_STATUS_RUNNING);
1bdc94
 
1bdc94
-    block_job_user_pause(job, &error_abort);
1bdc94
+    job_user_pause(&job->job, &error_abort);
1bdc94
     block_job_enter(job);
1bdc94
     assert(job->job.status == JOB_STATUS_PAUSED);
1bdc94
 
1bdc94
@@ -308,7 +310,7 @@ static void test_cancel_standby(void)
1bdc94
     block_job_enter(job);
1bdc94
     assert(job->job.status == JOB_STATUS_READY);
1bdc94
 
1bdc94
-    block_job_user_pause(job, &error_abort);
1bdc94
+    job_user_pause(&job->job, &error_abort);
1bdc94
     block_job_enter(job);
1bdc94
     assert(job->job.status == JOB_STATUS_STANDBY);
1bdc94
 
1bdc94
-- 
1bdc94
1.8.3.1
1bdc94