[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: |
Stefano Garzarella |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH] qcow2: Define and use QCOW2_COMPRESSED_SECTOR_SIZE |
Date: |
Mon, 13 May 2019 15:14:40 +0200 |
User-agent: |
NeoMutt/20180716 |
On Mon, May 13, 2019 at 01:48:27PM +0200, Alberto Garcia wrote:
> 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.
Thanks for the explaination and sorry for that!
Cheers,
Stefano