mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
job: Add job_drain()
block_job_drain() contains a blk_drain() call which cannot be moved to Job, so add a new JobDriver callback JobDriver.drain which has a common implementation for all BlockJobs. In addition to this we keep the existing BlockJobDriver.drain callback that is called by the common drain implementation for all block jobs. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
004e95df98
commit
b69f777dd9
11 changed files with 55 additions and 10 deletions
11
job.c
11
job.c
|
@ -367,6 +367,17 @@ void coroutine_fn job_sleep_ns(Job *job, int64_t ns)
|
|||
job_pause_point(job);
|
||||
}
|
||||
|
||||
void job_drain(Job *job)
|
||||
{
|
||||
/* If job is !busy this kicks it into the next pause point. */
|
||||
job_enter(job);
|
||||
|
||||
if (job->driver->drain) {
|
||||
job->driver->drain(job);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* All jobs must allow a pause point before entering their job proper. This
|
||||
* ensures that jobs can be paused prior to being started, then resumed later.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue