Skip to content
  • Stefan Hajnoczi's avatar
    fc9c0a9c
    blockjob: add pause points · fc9c0a9c
    Stefan Hajnoczi authored
    
    
    Block jobs are coroutines that usually perform I/O but sometimes also
    sleep or yield.  Currently only sleeping or yielded block jobs can be
    paused.  This means jobs that do not sleep or yield (using
    block_job_yield()) are unaffected by block_job_pause().
    
    Add block_job_pause_point() so that block jobs can mark quiescent points
    that are suitable for pausing.  This solves the problem that it can take
    a block job a long time to pause if it is performing a long series of
    I/O operations.
    
    Transitioning to paused state involves a .pause()/.resume() callback.
    These callbacks are used to ensure that I/O and event loop activity has
    ceased while the job is at a pause point.
    
    Note that this patch introduces a stricter pause state than previously.
    The job->busy flag was incorrectly documented as a quiescent state
    without I/O pending.  This is violated by any job that has I/O pending
    across sleep or block_job_yield(), like the mirror block job.
    
    [Add missing block_job_should_pause() check to avoid deadlock after
    job->driver->pause() in block_job_pause_point().
    --Stefan]
    
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Reviewed-by: default avatarFam Zheng <famz@redhat.com>
    Message-id: 1466096189-6477-4-git-send-email-stefanha@redhat.com
    fc9c0a9c
    blockjob: add pause points
    Stefan Hajnoczi authored
    
    
    Block jobs are coroutines that usually perform I/O but sometimes also
    sleep or yield.  Currently only sleeping or yielded block jobs can be
    paused.  This means jobs that do not sleep or yield (using
    block_job_yield()) are unaffected by block_job_pause().
    
    Add block_job_pause_point() so that block jobs can mark quiescent points
    that are suitable for pausing.  This solves the problem that it can take
    a block job a long time to pause if it is performing a long series of
    I/O operations.
    
    Transitioning to paused state involves a .pause()/.resume() callback.
    These callbacks are used to ensure that I/O and event loop activity has
    ceased while the job is at a pause point.
    
    Note that this patch introduces a stricter pause state than previously.
    The job->busy flag was incorrectly documented as a quiescent state
    without I/O pending.  This is violated by any job that has I/O pending
    across sleep or block_job_yield(), like the mirror block job.
    
    [Add missing block_job_should_pause() check to avoid deadlock after
    job->driver->pause() in block_job_pause_point().
    --Stefan]
    
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Reviewed-by: default avatarFam Zheng <famz@redhat.com>
    Message-id: 1466096189-6477-4-git-send-email-stefanha@redhat.com
Loading