]> git.ipfire.org Git - thirdparty/qemu.git/commit - blockjob.c
blockjob: add block_job_start_shim
authorJohn Snow <jsnow@redhat.com>
Thu, 16 Mar 2017 21:23:49 +0000 (17:23 -0400)
committerJeff Cody <jcody@redhat.com>
Wed, 22 Mar 2017 17:26:27 +0000 (13:26 -0400)
commite3796a245ad0efa65ca8d2dc6424562a8fbaeb6a
tree63f768f33962528c21e7c1820aee0089dad5cae9
parentd79df2a2ceb3cb0771146587e9a4bfb312577f46
blockjob: add block_job_start_shim

The purpose of this shim is to allow us to pause pre-started jobs.
The purpose of *that* is to allow us to buffer a pause request that
will be able to take effect before the job ever does any work, allowing
us to create jobs during a quiescent state (under which they will be
automatically paused), then resuming the jobs after the critical section
in any order, either:

(1) -block_job_start
    -block_job_resume (via e.g. drained_end)

(2) -block_job_resume (via e.g. drained_end)
    -block_job_start

The problem that requires a startup wrapper is the idea that a job must
start in the busy=true state only its first time-- all subsequent entries
require busy to be false, and the toggling of this state is otherwise
handled during existing pause and yield points.

The wrapper simply allows us to mandate that a job can "start," set busy
to true, then immediately pause only if necessary. We could avoid
requiring a wrapper, but all jobs would need to do it, so it's been
factored out here.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Message-id: 20170316212351.13797-2-jsnow@redhat.com
Signed-off-by: Jeff Cody <jcody@redhat.com>
blockjob.c