[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v9 05/14] blockjob: Add "ready" field
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH v9 05/14] blockjob: Add "ready" field |
Date: |
Sat, 5 Jul 2014 19:47:19 +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>
---
blockjob.c | 3 +++
include/block/blockjob.h | 5 +++++
qapi/block-core.json | 4 +++-
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/blockjob.c b/blockjob.c
index 2c98689..ff1d78e 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -260,6 +260,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;
}
@@ -295,6 +296,8 @@ void block_job_event_completed(BlockJob *job, const char
*msg)
void block_job_event_ready(BlockJob *job)
{
+ job->ready = true;
+
qapi_event_send_block_job_ready(job->driver->job_type,
bdrv_get_device_name(job->bs),
job->len,
diff --git a/include/block/blockjob.h b/include/block/blockjob.h
index 88f4be2..97658ca 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/block-core.json b/qapi/block-core.json
index e378653..72ebfef 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -505,12 +505,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:
--
2.0.1
- [Qemu-devel] [PATCH v9 10/14] qemu-img: Specify backing file for commit, (continued)
- [Qemu-devel] [PATCH v9 10/14] qemu-img: Specify backing file for commit, Max Reitz, 2014/07/05
- [Qemu-devel] [PATCH v9 11/14] iotests: Add _filter_qemu_img_map, Max Reitz, 2014/07/05
- [Qemu-devel] [PATCH v9 12/14] iotests: Add test for backing-chain commits, Max Reitz, 2014/07/05
- [Qemu-devel] [PATCH v9 13/14] iotests: Add test for qcow2's bdrv_make_empty, Max Reitz, 2014/07/05
- [Qemu-devel] [PATCH v9 14/14] iotests: Omit length/offset test in 040 and 041, Max Reitz, 2014/07/05
- [Qemu-devel] [PATCH v9 04/14] blockjob: Introduce block_job_complete_sync(), Max Reitz, 2014/07/05
- [Qemu-devel] [PATCH v9 03/14] qcow2: Optimize bdrv_make_empty(), Max Reitz, 2014/07/05
- [Qemu-devel] [PATCH v9 05/14] blockjob: Add "ready" field,
Max Reitz <=
- [Qemu-devel] [PATCH v9 06/14] block/mirror: Improve progress report, Max Reitz, 2014/07/05