Message ID | 401077e94fe70110ecf66ae36474e029d8919c92.1459776815.git.berto@igalia.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 04.04.2016 15:43, Alberto Garcia wrote: > 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 <berto@igalia.com> > --- > blockdev.c | 19 ++++++++----------- > 1 file changed, 8 insertions(+), 11 deletions(-) Reviewed-by: Max Reitz <mreitz@redhat.com>
Am 04.04.2016 um 15:43 hat Alberto Garcia geschrieben: > 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 <berto@igalia.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> However, I'd like to give you a heads-up that this will technically conflict with my series that removes BlockDriverState.blk because that changes the bdrv_next() signature. Nothing dramatic, but I guess it would make sense to decide where in the queue of patches this series should go. My suggestion would be on top of "blockdev: (Nearly) free clean-up work". Kevin
On Fri 29 Apr 2016 04:32:41 PM CEST, Kevin Wolf wrote: > However, I'd like to give you a heads-up that this will technically > conflict with my series that removes BlockDriverState.blk because that > changes the bdrv_next() signature. > > Nothing dramatic, but I guess it would make sense to decide where in > the queue of patches this series should go. My suggestion would be on > top of "blockdev: (Nearly) free clean-up work". Okay, thanks. Berto
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;
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 <berto@igalia.com> --- blockdev.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)