[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v9 03/11] block: use the block job list in qmp_query
From: |
Alberto Garcia |
Subject: |
[Qemu-devel] [PATCH v9 03/11] block: use the block job list in qmp_query_block_jobs() |
Date: |
Mon, 4 Apr 2016 16:43:53 +0300 |
qmp_query_block_jobs() uses bdrv_next() to look for block jobs, but
this function can only find those in top-level BlockDriverStates.
This patch uses block_job_next() instead.
Signed-off-by: Alberto Garcia <address@hidden>
---
blockdev.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index e50e8ea..edbcc19 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -4083,21 +4083,18 @@ out:
BlockJobInfoList *qmp_query_block_jobs(Error **errp)
{
BlockJobInfoList *head = NULL, **p_next = &head;
- BlockDriverState *bs;
+ BlockJob *job;
- for (bs = bdrv_next(NULL); bs; bs = bdrv_next(bs)) {
- AioContext *aio_context = bdrv_get_aio_context(bs);
+ for (job = block_job_next(NULL); job; job = block_job_next(job)) {
+ BlockJobInfoList *elem = g_new0(BlockJobInfoList, 1);
+ AioContext *aio_context = bdrv_get_aio_context(job->bs);
aio_context_acquire(aio_context);
-
- if (bs->job) {
- BlockJobInfoList *elem = g_new0(BlockJobInfoList, 1);
- elem->value = block_job_query(bs->job);
- *p_next = elem;
- p_next = &elem->next;
- }
-
+ elem->value = block_job_query(job);
aio_context_release(aio_context);
+
+ *p_next = elem;
+ p_next = &elem->next;
}
return head;
--
2.8.0.rc3
- Re: [Qemu-devel] [PATCH v9 10/11] qemu-iotests: test overlapping block-stream operations, (continued)
- [Qemu-devel] [PATCH v9 08/11] docs: Document how to stream to an intermediate layer, Alberto Garcia, 2016/04/04
- [Qemu-devel] [PATCH v9 04/11] block: use the block job list in bdrv_close(), Alberto Garcia, 2016/04/04
- [Qemu-devel] [PATCH v9 05/11] block: allow block jobs in any arbitrary node, Alberto Garcia, 2016/04/04
- [Qemu-devel] [PATCH v9 03/11] block: use the block job list in qmp_query_block_jobs(),
Alberto Garcia <=
- [Qemu-devel] [PATCH v9 07/11] block: Add QMP support for streaming to an intermediate layer, Alberto Garcia, 2016/04/04
- Re: [Qemu-devel] [PATCH v9 07/11] block: Add QMP support for streaming to an intermediate layer, Kevin Wolf, 2016/04/29
- Re: [Qemu-devel] [PATCH v9 07/11] block: Add QMP support for streaming to an intermediate layer, Eric Blake, 2016/04/29
- [Qemu-devel] [PATCH v9 09/11] qemu-iotests: test streaming to an intermediate layer, Alberto Garcia, 2016/04/04
- [Qemu-devel] [PATCH v9 11/11] qemu-iotests: test non-overlapping block-stream operations, Alberto Garcia, 2016/04/04