block: use the block job list in qmp_query_block_jobs()
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> Message-id: a8b7e5497b7c1fa67c12fcceae1630d01c3b1f96.1464346103.git.berto@igalia.com Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
		
							parent
							
								
									eb1364ceac
								
							
						
					
					
						commit
						f0f55deda2
					
				
							
								
								
									
										20
									
								
								blockdev.c
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								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 *qmp_query_block_jobs(Error **errp)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    BlockJobInfoList *head = NULL, **p_next = &head;
 | 
					    BlockJobInfoList *head = NULL, **p_next = &head;
 | 
				
			||||||
    BlockDriverState *bs;
 | 
					    BlockJob *job;
 | 
				
			||||||
    BdrvNextIterator it;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
 | 
					    for (job = block_job_next(NULL); job; job = block_job_next(job)) {
 | 
				
			||||||
        AioContext *aio_context = bdrv_get_aio_context(bs);
 | 
					        BlockJobInfoList *elem = g_new0(BlockJobInfoList, 1);
 | 
				
			||||||
 | 
					        AioContext *aio_context = blk_get_aio_context(job->blk);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        aio_context_acquire(aio_context);
 | 
					        aio_context_acquire(aio_context);
 | 
				
			||||||
 | 
					        elem->value = block_job_query(job);
 | 
				
			||||||
        if (bs->job) {
 | 
					 | 
				
			||||||
            BlockJobInfoList *elem = g_new0(BlockJobInfoList, 1);
 | 
					 | 
				
			||||||
            elem->value = block_job_query(bs->job);
 | 
					 | 
				
			||||||
            *p_next = elem;
 | 
					 | 
				
			||||||
            p_next = &elem->next;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        aio_context_release(aio_context);
 | 
					        aio_context_release(aio_context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        *p_next = elem;
 | 
				
			||||||
 | 
					        p_next = &elem->next;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return head;
 | 
					    return head;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user