aboutsummaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2016-03-22 18:58:50 +0100
committerKevin Wolf <kwolf@redhat.com>2016-05-19 16:45:31 +0200
commit7c8eece45b10fc9b716850345118ed6fa8d17887 (patch)
treea800da22963a8ff1d036a97a3281ddd555d07c91 /blockdev.c
parentdde33812a83b9c55b180a85411bfc4d6c39e8b11 (diff)
block: Avoid bs->blk in bdrv_next()
We need to introduce a separate BdrvNextIterator struct that can keep more state than just the current BDS in order to avoid using the bs->blk pointer. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/blockdev.c b/blockdev.c
index 03ddd3ac6e..442ca8d19d 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -4135,8 +4135,9 @@ BlockJobInfoList *qmp_query_block_jobs(Error **errp)
{
BlockJobInfoList *head = NULL, **p_next = &head;
BlockDriverState *bs;
+ BdrvNextIterator *it = NULL;
- for (bs = bdrv_next(NULL); bs; bs = bdrv_next(bs)) {
+ while ((it = bdrv_next(it, &bs))) {
AioContext *aio_context = bdrv_get_aio_context(bs);
aio_context_acquire(aio_context);