qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v4 24/30] qcow2: Clear the L2 bitmap when allocating a compre


From: Alberto Garcia
Subject: Re: [PATCH v4 24/30] qcow2: Clear the L2 bitmap when allocating a compressed cluster
Date: Fri, 24 Apr 2020 20:37:38 +0200
User-agent: Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu)

On Fri 24 Apr 2020 08:25:45 PM CEST, Vladimir Sementsov-Ogievskiy 
<address@hidden> wrote:
>>> Reading the entire cluster will be interesting - you'll have to
>>> decompress the entire memory, then overwrite the zeroed portions.
>> 
>> I don't think so, qcow2_get_host_offset() would detect the number of
>> contiguous subclusters of the same type at the given offset. In this
>> case they would be _ZERO subclusters so there's no need to decompress
>> anything, or even read it (it works the same with uncompressed
>> clusters).
>
> But if at least one of subclusters to read is not _ZERO, you'll have
> to decompress the whole cluster, and after decompression rewrite
> zero-subclusters by zeroes, as Eric says.. Or I lost the thread:)

I don't see why you would need to rewrite anything... you do have to
decompress the whole cluster, and the uncompressed cluster in memory
would have stale data, but you never need to use that data for anything,
let alone to return it to the guest.

Even if there's a COW, the new cluster would inherit the compressed
cluster's bitmap so the zeroized subclusters still read as zeroes.

It's the same with normal clusters, 'write -P 0xff 0 64k' followed by
'write -z 16k 16k'. The host cluster on disk still reads as 0xff but the
L2 entry indicates that part of it is just zeroes.

Berto



reply via email to

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