mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
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>
This commit is contained in:
parent
8254b6d953
commit
0df4ba5863
3 changed files with 51 additions and 9 deletions
12
blockdev.c
12
blockdev.c
|
@ -3610,7 +3610,7 @@ void qmp_block_job_cancel(const char *device,
|
|||
force = false;
|
||||
}
|
||||
|
||||
if (job->user_paused && !force) {
|
||||
if (block_job_user_paused(job) && !force) {
|
||||
error_setg(errp, "The block job for device '%s' is currently paused",
|
||||
device);
|
||||
goto out;
|
||||
|
@ -3627,13 +3627,12 @@ void qmp_block_job_pause(const char *device, Error **errp)
|
|||
AioContext *aio_context;
|
||||
BlockJob *job = find_block_job(device, &aio_context, errp);
|
||||
|
||||
if (!job || job->user_paused) {
|
||||
if (!job || block_job_user_paused(job)) {
|
||||
return;
|
||||
}
|
||||
|
||||
job->user_paused = true;
|
||||
trace_qmp_block_job_pause(job);
|
||||
block_job_pause(job);
|
||||
block_job_user_pause(job);
|
||||
aio_context_release(aio_context);
|
||||
}
|
||||
|
||||
|
@ -3642,14 +3641,13 @@ void qmp_block_job_resume(const char *device, Error **errp)
|
|||
AioContext *aio_context;
|
||||
BlockJob *job = find_block_job(device, &aio_context, errp);
|
||||
|
||||
if (!job || !job->user_paused) {
|
||||
if (!job || !block_job_user_paused(job)) {
|
||||
return;
|
||||
}
|
||||
|
||||
job->user_paused = false;
|
||||
trace_qmp_block_job_resume(job);
|
||||
block_job_iostatus_reset(job);
|
||||
block_job_resume(job);
|
||||
block_job_user_resume(job);
|
||||
aio_context_release(aio_context);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue