qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 08/20] block drivers: add discard/write_zeroe


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v2 08/20] block drivers: add discard/write_zeroes properties to bdrv_get_info implementation
Date: Thu, 21 Nov 2013 12:39:24 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130923 Thunderbird/17.0.9

Il 21/11/2013 12:33, Peter Lieven ha scritto:
> On 19.11.2013 18:07, Paolo Bonzini wrote:
>> Signed-off-by: Paolo Bonzini <address@hidden>
>> ---
>>   block/qcow2.c | 2 ++
>>   block/qed.c   | 2 ++
>>   block/vdi.c   | 3 +++
>>   block/vhdx.c  | 3 +++
>>   block/vpc.c   | 2 ++
>>   5 files changed, 12 insertions(+)
>>
>> diff --git a/block/qcow2.c b/block/qcow2.c
>> index 2fe37ed..92ed895 100644
>> --- a/block/qcow2.c
>> +++ b/block/qcow2.c
>> @@ -1892,6 +1892,8 @@ static coroutine_fn int
>> qcow2_co_flush_to_os(BlockDriverState *bs)
>>   static int qcow2_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
>>   {
>>       BDRVQcowState *s = bs->opaque;
>> +    bdi->unallocated_blocks_are_zero = (bs->backing_hd == NULL);
>> +    bdi->can_write_zeroes_with_unmap = (s->qcow_version >= 3);
>>       bdi->cluster_size = s->cluster_size;
>>       bdi->vm_state_offset = qcow2_vm_state_offset(s);
>>       return 0;
>> diff --git a/block/qed.c b/block/qed.c
>> index adc2736..1f87420 100644
>> --- a/block/qed.c
>> +++ b/block/qed.c
>> @@ -1475,6 +1475,8 @@ static int bdrv_qed_get_info(BlockDriverState
>> *bs, BlockDriverInfo *bdi)
>>       memset(bdi, 0, sizeof(*bdi));
>>       bdi->cluster_size = s->header.cluster_size;
>>       bdi->is_dirty = s->header.features & QED_F_NEED_CHECK;
>> +    bdi->unallocated_blocks_are_zero = (bs->backing_hd == NULL);
>> +    bdi->can_write_zeroes_with_unmap = true;
>>       return 0;
>>   }
>>   diff --git a/block/vdi.c b/block/vdi.c
>> index b6ec002..3a05027 100644
>> --- a/block/vdi.c
>> +++ b/block/vdi.c
>> @@ -331,6 +331,9 @@ static int vdi_get_info(BlockDriverState *bs,
>> BlockDriverInfo *bdi)
>>       logout("\n");
>>       bdi->cluster_size = s->block_size;
>>       bdi->vm_state_offset = 0;
>> +
>> +    /* Backing file not supported yet.  */
>> +    bdi->unallocated_blocks_are_zero = true;
> If its not supported why not checking for
> 
> (bs->backing_hd == NULL)
> 
> in case its added later and this place is overseen.

Actually, bdrv_unallocated_blocks_are_zero checks bs->backing_hd so it's
qcow2 and qed that should have "true" instead.

Paolo




reply via email to

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