qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH 04/15] block: Simplify find_block_job() and make


From: Max Reitz
Subject: Re: [Qemu-block] [PATCH 04/15] block: Simplify find_block_job() and make it accept a job ID
Date: Mon, 20 Jun 2016 20:29:14 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1

On 20.06.2016 18:40, Max Reitz wrote:
> On 09.06.2016 10:20, Alberto Garcia wrote:
>> find_block_job() looks for a block backend with a specified name,
>> checks whether it has a block job and acquires its AioContext. This
>> patch uses block_job_next() and iterate directly over the block jobs.
>>
>> In addition to that we want to identify jobs primarily by their ID, so
>> this patch updates find_block_job() to allow IDs too. Only one of ID
>> and device name can be specified when looking for a block job.
>>
>> Signed-off-by: Alberto Garcia <address@hidden>
>> ---
>>  blockdev.c | 66 
>> +++++++++++++++++++++++++++++++++-----------------------------
>>  1 file changed, 35 insertions(+), 31 deletions(-)
>>
>> diff --git a/blockdev.c b/blockdev.c
>> index 52ec4ae..bd0d5a1 100644
>> --- a/blockdev.c
>> +++ b/blockdev.c
>> @@ -3689,48 +3689,52 @@ void qmp_blockdev_mirror(const char *device, const 
>> char *target,

[...]

>> +static BlockJob *find_block_job(const char *id, const char *device,
>> +                                AioContext **aio_context, Error **errp)
>>  {
>> -    BlockBackend *blk;
>> -    BlockDriverState *bs;
>> +    BlockJob *job = NULL;
>>  
>>      *aio_context = NULL;
>>  
>> -    blk = blk_by_name(device);
>> -    if (!blk) {
>> -        goto notfound;
>> +    if ((id && device) || (!id && !device)) {
>> +        error_setg(errp, "Only one of ID or device name "
> 
> Maybe s/Only/Exactly/. Or it could just be an assertion.

Message from reviewing-patch-10-future-me: No, it should not be an
assertion.

Max

>> +                   "must be specified when looking for a block job");
>> +        return NULL;
>>      }
>> 

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]