aboutsummaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/blockdev.c b/blockdev.c
index 11177b4fcc..1d498c7b19 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -4157,22 +4157,18 @@ void qmp_x_blockdev_change(const char *parent, bool has_child,
BlockJobInfoList *qmp_query_block_jobs(Error **errp)
{
BlockJobInfoList *head = NULL, **p_next = &head;
- BlockDriverState *bs;
- BdrvNextIterator it;
+ BlockJob *job;
- for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
- 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 = blk_get_aio_context(job->blk);
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;