[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [RFC v4 09/21] blockjobs: add CONCLUDED st
From: |
John Snow |
Subject: |
Re: [Qemu-block] [Qemu-devel] [RFC v4 09/21] blockjobs: add CONCLUDED state |
Date: |
Tue, 27 Feb 2018 14:44:03 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
On 02/27/2018 02:38 PM, Eric Blake wrote:
> On 02/23/2018 05:51 PM, John Snow wrote:
>> add a new state "CONCLUDED" that identifies a job that has ceased all
>> operations. The wording was chosen to avoid any phrasing that might
>> imply success, error, or cancellation. The task has simply ceased all
>> operation and can never again perform any work.
>>
>> ("finished", "done", and "completed" might all imply success.)
>>
>> Transitions:
>> Running -> Concluded: normal completion
>> Ready -> Concluded: normal completion
>> Aborting -> Concluded: error and cancellations
>>
>> Verbs:
>> None as of this commit. (a future commit adds 'dismiss')
>>
>
>
>> @@ -620,7 +623,9 @@ void block_job_user_resume(BlockJob *job, Error
>> **errp)
>> void block_job_cancel(BlockJob *job)
>> {
>> - if (block_job_started(job)) {
>> + if (job->status == BLOCK_JOB_STATUS_CONCLUDED) {
>> + return;
>> + } else if (block_job_started(job)) {
>
> It's also possible to do:
>
> if () {
> return ;
> }
> if (...)
>
> instead of chaining with an 'else if'. Matter of personal taste, so I
> won't make you change it.
>
> Reviewed-by: Eric Blake <address@hidden>
>
I guess because in this case, what I did adds two SLOC instead of three.
If the other code did not need to be guarded by an if(), I'd otherwise
agree.