qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH for-2.10 14/16] block/qcow2: falloc/full preallo


From: Max Reitz
Subject: Re: [Qemu-block] [PATCH for-2.10 14/16] block/qcow2: falloc/full preallocating growth
Date: Mon, 20 Mar 2017 16:15:59 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 20.03.2017 12:29, Stefan Hajnoczi wrote:
> On Mon, Mar 13, 2017 at 10:41:15PM +0100, Max Reitz wrote:
>> Implement the preallocation modes falloc and full for growing qcow2
>> images.
>>
>> Signed-off-by: Max Reitz <address@hidden>
>> ---
>>  block/qcow2.c | 36 +++++++++++++++++++++++++++++++++++-
>>  1 file changed, 35 insertions(+), 1 deletion(-)
>>
>> diff --git a/block/qcow2.c b/block/qcow2.c
>> index 80fb815b15..b6b08d70da 100644
>> --- a/block/qcow2.c
>> +++ b/block/qcow2.c
>> @@ -2604,7 +2604,9 @@ static int qcow2_truncate(BlockDriverState *bs, 
>> int64_t offset,
>>      int64_t new_l1_size;
>>      int ret;
>>  
>> -    if (prealloc != PREALLOC_MODE_OFF && prealloc != 
>> PREALLOC_MODE_METADATA) {
>> +    if (prealloc != PREALLOC_MODE_OFF && prealloc != PREALLOC_MODE_METADATA 
>> &&
>> +        prealloc != PREALLOC_MODE_FALLOC && prealloc != PREALLOC_MODE_FULL)
> 
> Now all cases are covered so this if statement can be dropped.  If you
> are worried about new preallocation modes being added in the future then
> the error_setg() can be moved into the switch statement's default case.

No, because the switch comes after we have already grown the L1 table.
That wouldn't be so nice.

Max

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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