diff options
author | Kevin Wolf <kwolf@redhat.com> | 2018-04-20 14:56:08 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2018-05-23 14:30:50 +0200 |
commit | 004e95df98266da33e08c9f1731aca71b6d6d7c4 (patch) | |
tree | fb978b083b796cca2c0fad011557841d6f330ede /include/qemu | |
parent | 4ad351819b974d724e926fd23cdd66bec3c9768e (diff) | |
download | qemu-004e95df98266da33e08c9f1731aca71b6d6d7c4.zip qemu-004e95df98266da33e08c9f1731aca71b6d6d7c4.tar.gz qemu-004e95df98266da33e08c9f1731aca71b6d6d7c4.tar.bz2 |
job: Convert block_job_cancel_async() to Job
block_job_cancel_async() did two things that were still block job
specific:
* Setting job->force. This field makes sense on the Job level, so we can
just move it. While at it, rename it to job->force_cancel to make its
purpose more obvious.
* Resetting the I/O status. This can't be moved because generic Jobs
don't have an I/O status. What the function really implements is a
user resume, except without entering the coroutine. Consequently, it
makes sense to call the .user_resume driver callback here which
already resets the I/O status.
The old block_job_cancel_async() has two separate if statements that
check job->iostatus != BLOCK_DEVICE_IO_STATUS_OK and job->user_paused.
However, the former condition always implies the latter (as is
asserted in block_job_iostatus_reset()), so changing the explicit call
of block_job_iostatus_reset() on the former condition with the
.user_resume callback on the latter condition is equivalent and
doesn't need to access any BlockJob specific state.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'include/qemu')
-rw-r--r-- | include/qemu/job.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/qemu/job.h b/include/qemu/job.h index 3e817be..2648c74 100644 --- a/include/qemu/job.h +++ b/include/qemu/job.h @@ -97,6 +97,12 @@ typedef struct Job { */ bool cancelled; + /** + * Set to true if the job should abort immediately without waiting + * for data to be in sync. + */ + bool force_cancel; + /** Set to true when the job has deferred work to the main loop. */ bool deferred_to_main_loop; |