[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v6 4/9] qcow2: make refcount size calculation co
From: |
Max Reitz |
Subject: |
Re: [Qemu-devel] [PATCH v6 4/9] qcow2: make refcount size calculation conservative |
Date: |
Mon, 8 May 2017 21:06:08 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 |
On 08.05.2017 17:00, Eric Blake wrote:
> On 05/08/2017 09:15 AM, Stefan Hajnoczi wrote:
>> The refcount metadata size calculation is inaccurate and can produce
>> numbers that are too small. This is bad because we should calculate a
>> conservative number - one that is guaranteed to be large enough.
>>
>> This patch switches the approach to a fixed point calculation because
>> the existing equation is hard to solve when inaccuracies are taken care
>> of.
>>
>> Signed-off-by: Stefan Hajnoczi <address@hidden>
>> Reviewed-by: Alberto Garcia <address@hidden>
>> ---
>> block/qcow2.c | 82
>> ++++++++++++++++++++++++++++++-----------------------------
>> 1 file changed, 42 insertions(+), 40 deletions(-)
>>
>
>> - nrefblocke = (aligned_total_size + meta_size + cluster_size)
>> - / (cluster_size - rces - rces * sizeof(uint64_t)
>> - / cluster_size);
>> - meta_size += DIV_ROUND_UP(nrefblocke, refblock_size) * cluster_size;
>> -
>> - /* total size of refcount tables */
>> - nreftablee = nrefblocke / refblock_size;
>> - nreftablee = align_offset(nreftablee, cluster_size / sizeof(uint64_t));
>> - meta_size += nreftablee * sizeof(uint64_t);
>> + /* total size of refcount table and blocks */
>> + meta_size += qcow2_refcount_metadata_size(
>> + (meta_size + aligned_total_size) / cluster_size,
>
> How does this interact with Max's patch which avoids truncating division
> in favor of rounding up?
> https://lists.gnu.org/archive/html/qemu-devel/2017-05/msg00690.html
From a quick glance, it looks like it just reimplements everything in a
(hopefully) more understandable and "generous" way (which is good). So
the only interaction is that the code that's removed/replaced is a bit
different (which implies a rebase conflict, but one that should be
resolved pretty easily).
Max
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v6 0/9] qemu-img: add measure sub-command, Stefan Hajnoczi, 2017/05/08
- [Qemu-devel] [PATCH v6 1/9] block: add bdrv_measure() API, Stefan Hajnoczi, 2017/05/08
- [Qemu-devel] [PATCH v6 2/9] raw-format: add bdrv_measure() support, Stefan Hajnoczi, 2017/05/08
- [Qemu-devel] [PATCH v6 3/9] qcow2: extract preallocation calculation function, Stefan Hajnoczi, 2017/05/08
- [Qemu-devel] [PATCH v6 4/9] qcow2: make refcount size calculation conservative, Stefan Hajnoczi, 2017/05/08
- [Qemu-devel] [PATCH v6 5/9] qcow2: extract image creation option parsing, Stefan Hajnoczi, 2017/05/08
- [Qemu-devel] [PATCH v6 6/9] qcow2: add bdrv_measure() support, Stefan Hajnoczi, 2017/05/08
- [Qemu-devel] [PATCH v6 7/9] qemu-img: add measure subcommand, Stefan Hajnoczi, 2017/05/08
- [Qemu-devel] [PATCH v6 9/9] iotests: add test 178 for qemu-img measure, Stefan Hajnoczi, 2017/05/08
- [Qemu-devel] [PATCH v6 8/9] qemu-iotests: support per-format golden output files, Stefan Hajnoczi, 2017/05/08
- Re: [Qemu-devel] [PATCH v6 0/9] qemu-img: add measure sub-command, Stefan Hajnoczi, 2017/05/24