qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [Qemu-devel] [PATCH] qcow2: Define and use QCOW2_COMPRE


From: Alberto Garcia
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH] qcow2: Define and use QCOW2_COMPRESSED_SECTOR_SIZE
Date: Mon, 13 May 2019 13:48:27 +0200
User-agent: Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu)

On Mon 13 May 2019 01:28:46 PM CEST, Stefano Garzarella wrote:
>> +            int size = QCOW2_COMPRESSED_SECTOR_SIZE *
>> +                (((l2_entry >> s->csize_shift) & s->csize_mask) + 1);
>
> What about using int64_t type for the 'size' variable?
> (because the qcow2_free_clusters() 'size' parameter is int64_t)

The maximum size that can be read from a compressed cluster descriptor
using the formula above is twice the cluster size (more information on
commit abd3622cc03cf41ed542126a540385f30a4c0175 and on the Compressed
Clusters Descriptor spec in docs/interop/qcow2.txt).

Since the maximum allowed cluster size is 2MB, the value of the 'size'
variable can never be larger than 4MB, which fits comfortably on a
32-bit integer. We would need to support 512MB clusters in order to have
problems with this.

Berto



reply via email to

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