qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [Qemu-devel] [PATCH v2 1/2] block: Disallow snapshots i


From: Alberto Garcia
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH v2 1/2] block: Disallow snapshots if the overlay doesn't support backing files
Date: Mon, 02 Nov 2015 18:10:09 +0100
User-agent: Notmuch/0.13.2 (http://notmuchmail.org) Emacs/23.2.1 (i486-pc-linux-gnu)

On Mon 02 Nov 2015 05:11:46 PM CET, Eric Blake <address@hidden> wrote:
>> @@ -1667,6 +1667,11 @@ static void 
>> external_snapshot_prepare(BlkTransactionState *common,
>>  
>>      if (state->new_bs->backing != NULL) {
>>          error_setg(errp, "The snapshot already has a backing image");
>> +        return;
>> +    }
>> +
>> +    if (!state->new_bs->drv->supports_backing) {
>> +        error_setg(errp, "The snapshot does not support backing images");
>>      }
>>  }
>
> You could avoid the 'return' by doing:
>
> if (state->new_bs->backing) {
>     error_setg(...);
> } else if (!state->new_bs->drv->supports_backing) {
>     error_setg(...);
> }

There's three more checks immediately before these lines, so I would
have had to turn everything into a series of if / else if, which is a
bit more unreadable in this case in my opinion. That's why I decided to
leave it like it is in the patch.

Berto



reply via email to

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