diff options
author | Alberto Garcia <berto@igalia.com> | 2016-10-28 10:08:04 +0300 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-10-31 16:52:38 +0100 |
commit | 23d402d42beb975b97303beb3d9d4f60f4a1a883 (patch) | |
tree | 93d21dba765ab21fd555ea8630d504e48e92964b /include/block | |
parent | 40840e419be31e6a32e6ea24511c74b389d5e0e4 (diff) |
block: Add block_job_add_bdrv()
When a block job is created on a certain BlockDriverState, operations
are blocked there while the job exists. However, some block jobs may
involve additional BDSs, which must be blocked separately when the job
is created and unblocked manually afterwards.
This patch adds block_job_add_bdrv(), that simplifies this process by
keeping a list of BDSs that are involved in the specified block job.
Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'include/block')
-rw-r--r-- | include/block/blockjob.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/block/blockjob.h b/include/block/blockjob.h index 2bb39f4d29..4dfb16b43f 100644 --- a/include/block/blockjob.h +++ b/include/block/blockjob.h @@ -188,6 +188,9 @@ struct BlockJob { /** Block other operations when block job is running */ Error *blocker; + /** BlockDriverStates that are involved in this block job */ + GSList *nodes; + /** The opaque value that is passed to the completion function. */ void *opaque; @@ -253,6 +256,17 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver, BlockCompletionFunc *cb, void *opaque, Error **errp); /** + * block_job_add_bdrv: + * @job: A block job + * @bs: A BlockDriverState that is involved in @job + * + * Add @bs to the list of BlockDriverState that are involved in + * @job. This means that all operations will be blocked on @bs while + * @job exists. + */ +void block_job_add_bdrv(BlockJob *job, BlockDriverState *bs); + +/** * block_job_sleep_ns: * @job: The job that calls the function. * @clock: The clock to sleep on. |