[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH 07/17] block: make high level discard operat
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [RFC PATCH 07/17] block: make high level discard operation always zero |
Date: |
Fri, 09 Mar 2012 17:42:46 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120209 Thunderbird/10.0.1 |
Am 08.03.2012 18:55, schrieb Avi Kivity:
> On 03/08/2012 07:15 PM, Paolo Bonzini wrote:
>> While the formats/protocols are free to implement a discard operation
>> that does *not* zero the data, providing a common view to the guests is
>> the only way to avoid configuration and migration nightmares. (We don't
>> want the admin to manually set up discard_zeroes_data/discard_granularity!)
>>
>> This has a couple of drawbacks:
>>
>> 1) QEMU effectively will not try to use discard unless discard_zeroes_data
>> is true. To do this we could add a flag such as BDRV_ALWAYS_DISCARD,
>> which the device models could use if their discard_zeroes_data property is
>> set to false. However, I haven't done this, estimating that no strictly
>> positive integer could represent the number of people using it.
>>
>> 2) it may turn a thin-provisioning operation into a full preallocation,
>> which is not nice.
>>
>> 3) it may cost memory for a bounce buffer that only needs to be filled
>> with zeroes.
>>
>> While (3) can be worked around, the only way around the other two,
>> unfortunately, is support in the formats and protocols. We will still
>> provide device options to opt out of this, but with raw and qed covered
>> (+ qcow2 without backing file, and qcow3 in the future) it should not
>> be too bad.
>
> Can't qcow2 with a backing file also be supported? Zero out the first
> cluster, and remember it. The following discards can reuse this zero
> cluster, as long as it hasn't been overwritten.
qcow2 can't handle clusters that are referenced twice from the same L1
table. This would require a reverse lookup to adjust the QCOW_O_COPIED
flags in the L2 tables containing the other references.
Kevin
- Re: [Qemu-devel] [RFC PATCH 10/17] ide/scsi: add discard_zeroes_data property, (continued)
- [Qemu-devel] [RFC PATCH 09/17] ide: issue discard asynchronously but serialize the pieces, Paolo Bonzini, 2012/03/08
- [Qemu-devel] [RFC PATCH 05/17] block: pass around qiov for write_zeroes operation, Paolo Bonzini, 2012/03/08
- [Qemu-devel] [RFC PATCH 12/17] ide/scsi: turn on discard, Paolo Bonzini, 2012/03/08
- [Qemu-devel] [RFC PATCH 01/17] qemu-iotests: add a simple test for write_zeroes, Paolo Bonzini, 2012/03/08
- [Qemu-devel] [RFC PATCH 11/17] ide/scsi: prepare for flipping the discard defaults, Paolo Bonzini, 2012/03/08
- [Qemu-devel] [RFC PATCH 16/17] qemu-io: fix the alloc command, Paolo Bonzini, 2012/03/08
- [Qemu-devel] [RFC PATCH 07/17] block: make high level discard operation always zero, Paolo Bonzini, 2012/03/08
[Qemu-devel] [RFC PATCH 08/17] block: kill the write zeroes operation, Paolo Bonzini, 2012/03/08
[Qemu-devel] [RFC PATCH 15/17] raw: add get_info, Paolo Bonzini, 2012/03/08
[Qemu-devel] [RFC PATCH 14/17] block: support FALLOC_FL_PUNCH_HOLE trimming, Paolo Bonzini, 2012/03/08