[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v7 05/14] blockjob: Add "ready" field
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH v7 05/14] blockjob: Add "ready" field |
Date: |
Thu, 8 May 2014 21:35:39 +0200 |
When a block job signals readiness, this is currently reported only
through QMP. If qemu wants to use block jobs for internal tasks, there
needs to be another way to correctly detect when a block job may be
completed.
For this reason, introduce a bool "ready" which is set when the block
job may be completed.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
---
blockjob.c | 7 ++++++-
include/block/blockjob.h | 5 +++++
qapi-schema.json | 4 +++-
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/blockjob.c b/blockjob.c
index 9c7b198..a4271c1 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -242,6 +242,7 @@ BlockJobInfo *block_job_query(BlockJob *job)
info->offset = job->offset;
info->speed = job->speed;
info->io_status = job->iostatus;
+ info->ready = job->ready;
return info;
}
@@ -270,7 +271,11 @@ QObject *qobject_from_block_job(BlockJob *job)
void block_job_ready(BlockJob *job)
{
- QObject *data = qobject_from_block_job(job);
+ QObject *data;
+
+ job->ready = true;
+
+ data = qobject_from_block_job(job);
monitor_protocol_event(QEVENT_BLOCK_JOB_READY, data);
qobject_decref(data);
}
diff --git a/include/block/blockjob.h b/include/block/blockjob.h
index 626ea42..4a920e7 100644
--- a/include/block/blockjob.h
+++ b/include/block/blockjob.h
@@ -91,6 +91,11 @@ struct BlockJob {
*/
bool busy;
+ /**
+ * Set to true when the job is ready to be completed.
+ */
+ bool ready;
+
/** Status that is published by the query-block-jobs QMP API */
BlockDeviceIoStatus iostatus;
diff --git a/qapi-schema.json b/qapi-schema.json
index 36cb964..c9b9f09 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -1578,12 +1578,14 @@
#
# @io-status: the status of the job (since 1.3)
#
+# @ready: true if the job may be completed (since 2.1)
+#
# Since: 1.1
##
{ 'type': 'BlockJobInfo',
'data': {'type': 'str', 'device': 'str', 'len': 'int',
'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
- 'io-status': 'BlockDeviceIoStatus'} }
+ 'io-status': 'BlockDeviceIoStatus', 'ready': 'bool'} }
##
# @query-block-jobs:
--
1.9.2
- [Qemu-devel] [PATCH v7 00/14] qemu-img: Implement commit like QMP, Max Reitz, 2014/05/08
- [Qemu-devel] [PATCH v7 01/14] qcow2: Allow "full" discard, Max Reitz, 2014/05/08
- [Qemu-devel] [PATCH v7 02/14] qcow2: Implement bdrv_make_empty(), Max Reitz, 2014/05/08
- [Qemu-devel] [PATCH v7 03/14] qcow2: Optimize bdrv_make_empty(), Max Reitz, 2014/05/08
- [Qemu-devel] [PATCH v7 04/14] blockjob: Introduce block_job_complete_sync(), Max Reitz, 2014/05/08
- [Qemu-devel] [PATCH v7 05/14] blockjob: Add "ready" field,
Max Reitz <=
- [Qemu-devel] [PATCH v7 06/14] block/mirror: Improve progress report, Max Reitz, 2014/05/08
- [Qemu-devel] [PATCH v7 07/14] qemu-img: Implement commit like QMP, Max Reitz, 2014/05/08
- [Qemu-devel] [PATCH v7 08/14] qemu-img: Empty image after commit, Max Reitz, 2014/05/08
- [Qemu-devel] [PATCH v7 09/14] qemu-img: Enable progress output for commit, Max Reitz, 2014/05/08
- [Qemu-devel] [PATCH v7 10/14] qemu-img: Specify backing file for commit, Max Reitz, 2014/05/08
- [Qemu-devel] [PATCH v7 11/14] iotests: Add _filter_qemu_img_map, Max Reitz, 2014/05/08
- [Qemu-devel] [PATCH v7 12/14] iotests: Add test for backing-chain commits, Max Reitz, 2014/05/08
- [Qemu-devel] [PATCH v7 13/14] iotests: Add test for qcow2's bdrv_make_empty, Max Reitz, 2014/05/08
- [Qemu-devel] [PATCH v7 14/14] iotests: Omit length/offset test in 040 and 041, Max Reitz, 2014/05/08