On Mon 15 Jan 2018 07:21:01 PM CET, Anton Nefedov wrote:
>>>       /**
>>> +     * Indicates that both COW areas are empty (nb_bytes == 0)
>>> +     * or filled with zeroes and do not require any more copying
>>> +     */
>>> +    bool zero_cow;
[...]
>>> -    if (start->nb_bytes == 0 && end->nb_bytes == 0) {
>>> +    if ((start->nb_bytes == 0 && end->nb_bytes == 0) || m->zero_cow) {
>>>           return 0;
>>>       }
>> 
>> Here, 'if (m->zero_cow)' would suffice.
>
> The thing is, zero_cow is not assigned on some code paths,
> e.g. !(bs->file->bs->supported_zero_flags & BDRV_REQ_ALLOCATE)
> or when bs->encrypted.

Right, that's why I said that the comment on the zero_cow field is
incorrect, zero_cow does not indicate when nb_bytes == 0.

> but now thinking about this again; probably it should be - that will
> be least confusing. I'll fix

Choose the simplest solution, as long as the documentation matches the
semantics.

Berto

Reply via email to