summaryrefslogtreecommitdiff
path: root/blockjob.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-09-28 17:22:50 +0200
committerKevin Wolf <kwolf@redhat.com>2012-09-28 19:14:32 +0200
commit8acc72a4d20910d522516dab31272fe66da8da28 (patch)
tree4d521649f4d3a32eb74cf021ea12cfc1fc763e8f /blockjob.h
parent8d65883fff22e00d70f5880a26b7a1248c59a2d8 (diff)
downloadqemu-8acc72a4d20910d522516dab31272fe66da8da28.tar.gz
block: add support for job pause/resume
Job pausing reuses the existing support for cancellable sleeps. A pause happens at the next sleeping point and lasts until the coroutine is re-entered explicitly. Cancellation was already doing a forced resume, so implement it explicitly in terms of resume. Paused jobs cannot be canceled without first resuming them. This ensures that I/O errors are never missed by management. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockjob.h')
-rw-r--r--blockjob.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/blockjob.h b/blockjob.h
index f3d8d58ce3..ece5afa75b 100644
--- a/blockjob.h
+++ b/blockjob.h
@@ -70,6 +70,12 @@ struct BlockJob {
bool cancelled;
/**
+ * Set to true if the job is either paused, or will pause itself
+ * as soon as possible (if busy == true).
+ */
+ bool paused;
+
+ /**
* Set to false by the job while it is in a quiescent state, where
* no I/O is pending and the job has yielded on any condition
* that is not detected by #qemu_aio_wait, such as a timer.
@@ -171,6 +177,31 @@ bool block_job_is_cancelled(BlockJob *job);
BlockJobInfo *block_job_query(BlockJob *job);
/**
+ * block_job_pause:
+ * @job: The job to be paused.
+ *
+ * Asynchronously pause the specified job.
+ */
+void block_job_pause(BlockJob *job);
+
+/**
+ * block_job_resume:
+ * @job: The job to be resumed.
+ *
+ * Resume the specified job.
+ */
+void block_job_resume(BlockJob *job);
+
+/**
+ * block_job_is_paused:
+ * @job: The job being queried.
+ *
+ * Returns whether the job is currently paused, or will pause
+ * as soon as it reaches a sleeping point.
+ */
+bool block_job_is_paused(BlockJob *job);
+
+/**
* block_job_cancel_sync:
* @job: The job to be canceled.
*