diff options
Diffstat (limited to 'blockjob.c')
-rw-r--r-- | blockjob.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/blockjob.c b/blockjob.c index 309ef9a35c..d880ad2bd5 100644 --- a/blockjob.c +++ b/blockjob.c @@ -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; |