qemu-devel
[Top][All Lists]
Advanced

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

Re: qcow2: Zero-initialization of external data files


From: Max Reitz
Subject: Re: qcow2: Zero-initialization of external data files
Date: Thu, 9 Apr 2020 16:10:18 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0

On 09.04.20 15:47, Eric Blake wrote:
> On 4/9/20 8:42 AM, Eric Blake wrote:
> 
>>>> I'd argue that requiring the user to pre-zero the raw data file is
>>>> undesirable; and that we should instead fix our code to not report the
>>>> image as reading all zeroes when creating with data_file_raw=on.
>>>
>>> OK.  I think that could be achieved by just enforcing @preallocation to
>>> be at least “metadata” whenever @data-file-raw is set.  Would that make
>>> sense?
>>
>> Is a preallocation of metadata sufficient to report things correctly?
>> If so, it seems like a reasonable compromise to me.  I was more
>> envisioning a fix elsewhere: if we are reporting block status of what
>> looks like an unallocated cluster, but data-file-raw is set, we change
>> our answer to instead report it as allocated with unknown contents. 
>> But with preallocation, you either force the qcow2 file to list no
>> cluster as unallocated (which matches the fact that the raw image
>> really is fully allocated) while not touching the raw image, or you
>> can go one step further and request full preallocation to wipe the raw
>> image to 0 in the process.
> 
> What happens when an operation attempts to unmap things?  Do we reject
> all unmap operations when data-file-raw is set (thus leaving a cluster
> marked as allocated at all times, if we can first guarantee that
> preallocation set things up that way)?
No, unmap operations currently work.  qcow2_free_any_clusters() passes
them through to the external data file.

The problem is that the unmap also zeroes the L2 entry, so if you then
write data to the raw file, it won’t be visible from the qcow2 side of
things.  However, I’m not sure whether we support modifications of a raw
file when it is already “in use” by a qcow2 image, so maybe that’s fine.

Max

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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