[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 05/12] block: add logical block provisioning inf
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 05/12] block: add logical block provisioning information to BlockDriverInfo |
Date: |
Mon, 16 Sep 2013 13:37:50 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 |
Il 16/09/2013 13:30, Peter Lieven ha scritto:
> On 13.09.2013 13:45, Paolo Bonzini wrote:
>> Il 13/09/2013 12:44, Peter Lieven ha scritto:
>>> On 13.09.2013 12:34, Paolo Bonzini wrote:
>>>> Il 13/09/2013 12:25, Peter Lieven ha scritto:
>>>>> + /* maximum number of sectors that can be discarded at once */
>>>>> + int max_discard;
>>>>> + /* maximum number of sectors that can zeroized at once */
>>>>> + int max_write_zeroes;
>>>> These should not be needed outside the driver.
>>>>
>>>> If you want to make them private between block.c and block/iscsi.c, you
>>>> can add them to BlockDriverState.
>>> The question is, if the discard_zeroes or discard_write_zeroes is needed
>>> outside the driver as well?
>>>
>>> I can put the max_* information in the block driver state. I also
>>> thought
>>> to add alignment and granularity information even if they are currently
>>> not yet used.
>> Yeah, in fact bdrv_write_zeroes and bdrv_discard can be taught to split
>> requests according to these parameters instead of introducing a new
>> function bdrv_zeroize. You don't need bdrv_zeroize I think; you can
>> simply use bdrv_write_zeroes. This is why I don't like this information
>> in BlockDriverInfo.
>>
>> On the contrary, discard_write_zeroes is useful to "generic" clients,
>> and your qemu-img patch shows why.
>>
>> Discard_zeroes is somewhere in the middle. You only use it in
>> bdrv_get_block_status, but it is not something that should be hidden to
>> users of the high-level block.c API. So it is fine to leave it in
>> BlockDriverInfo.
>
> Would you also be ok to introduce bdrv_has_discard_zeroes()
> and bdrv_has_discard_write_zeroes() as Kevin suggested to avoid the need to
> add the logic to return 0 if there is a bs->backing_hd everywhere.
If Kevin says it, I agree. :)
> This would also make the use of it easier as it avoids the steps
> necessary to invoke bdrv_get_info().
Another possibility could be to put the "info" in a member of
BlockDriverState, since it is static. Then bdrv_get_info() could be simply
return &bs->info;
which is faster and removes the need for a BlockDriverInfo temporary.
Paolo
- [Qemu-devel] [PATCH 07/12] block: introduce bdrv_zeroize, (continued)
[Qemu-devel] [PATCH 06/12] iscsi: add .bdrv_get_info, Peter Lieven, 2013/09/13
[Qemu-devel] [PATCH 11/12] block/get_block_status: avoid redundant callouts on raw devices, Peter Lieven, 2013/09/13
[Qemu-devel] [PATCH 09/12] block/get_block_status: set *pnum = 0 on error, Peter Lieven, 2013/09/13
[Qemu-devel] [PATCH 10/12] block/get_block_status: avoid segfault if there is no backing_hd, Peter Lieven, 2013/09/13
[Qemu-devel] [PATCH 12/12] block/get_block_status: fix BDRV_BLOCK_ZERO for unallocated blocks, Peter Lieven, 2013/09/13