diff options
author | John Snow <jsnow@redhat.com> | 2016-10-27 12:06:59 -0400 |
---|---|---|
committer | Jeff Cody <jcody@redhat.com> | 2016-11-01 07:55:57 -0400 |
commit | 0df4ba58631772dd391314c1119863b574ebbaf9 (patch) | |
tree | e2e9931226b491f08a2845cab9b1eb7e6447d0ac /blockjob.c | |
parent | 8254b6d9534ba6a7d078a717e777fefe75ec27b6 (diff) | |
download | qemu-0df4ba58631772dd391314c1119863b574ebbaf9.zip qemu-0df4ba58631772dd391314c1119863b574ebbaf9.tar.gz qemu-0df4ba58631772dd391314c1119863b574ebbaf9.tar.bz2 |
Blockjobs: Internalize user_pause logic
BlockJobs will begin hiding their state in preparation for some
refactorings anyway, so let's internalize the user_pause mechanism
instead of leaving it to callers to correctly manage.
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Message-id: 1477584421-1399-6-git-send-email-jsnow@redhat.com
Signed-off-by: Jeff Cody <jcody@redhat.com>
Diffstat (limited to 'blockjob.c')
-rw-r--r-- | blockjob.c | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -373,11 +373,22 @@ void block_job_pause(BlockJob *job) job->pause_count++; } +void block_job_user_pause(BlockJob *job) +{ + job->user_paused = true; + block_job_pause(job); +} + static bool block_job_should_pause(BlockJob *job) { return job->pause_count > 0; } +bool block_job_user_paused(BlockJob *job) +{ + return job ? job->user_paused : 0; +} + void coroutine_fn block_job_pause_point(BlockJob *job) { if (!block_job_should_pause(job)) { @@ -414,6 +425,14 @@ void block_job_resume(BlockJob *job) block_job_enter(job); } +void block_job_user_resume(BlockJob *job) +{ + if (job && job->user_paused && job->pause_count > 0) { + job->user_paused = false; + block_job_resume(job); + } +} + void block_job_enter(BlockJob *job) { if (job->co && !job->busy) { @@ -644,8 +663,7 @@ BlockErrorAction block_job_error_action(BlockJob *job, BlockdevOnError on_err, } if (action == BLOCK_ERROR_ACTION_STOP) { /* make the pause user visible, which will be resumed from QMP. */ - job->user_paused = true; - block_job_pause(job); + block_job_user_pause(job); block_job_iostatus_set_err(job, error); } return action; |