[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 08/15] qcow2: skip writing zero buffers to em
From: |
Alberto Garcia |
Subject: |
Re: [Qemu-devel] [PATCH v5 08/15] qcow2: skip writing zero buffers to empty COW areas |
Date: |
Mon, 15 Jan 2018 21:12:17 +0100 |
User-agent: |
Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) |
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