From: Max Reitz <mreitz@redhat.com>
To: John Snow <jsnow@redhat.com>,
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: kwolf@redhat.com, den@openvz.org
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] qemu-img: improve convert_iteration_sectors()
Date: Wed, 26 Apr 2017 22:56:11 +0200 [thread overview]
Message-ID: <ff7ac681-72ae-6b9d-dbe8-ca3f224bbce8@redhat.com> (raw)
In-Reply-To: <e8e164db-ef51-63e6-3294-c43e4951a89c@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2156 bytes --]
On 20.04.2017 01:06, John Snow wrote:
>
>
> On 04/07/2017 07:34 AM, Vladimir Sementsov-Ogievskiy wrote:
>> Do not do extra call to _get_block_status()
>>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>> ---
>>
>> Also, I'm not sure about last line:
>> s->status = s->target_has_backing ? BLK_BACKING_FILE : BLK_DATA;
>>
>> (which is equal to old code)
>>
>
> What a weird function.
>
> So, if the target has a backing file, literally nothing changes here.
>
> If it doesn't, we skip the initial call to get_block_status and just
> call the (effectively?) recursive version to find out if we have a ZERO
> or DATA type of allocation.
>
> The else clause here properly reflects the original reading of the code.
>
> OK.
Well, this is what happens when optimizing parts of something without
looking at the bigger picture (263a6f4c3aa).
>> may be, it should be
>> s->status = s->target_has_backing ? BLK_BACKING_FILE : BLK_ZERO;
>>
>> as it is the case, when range is not allocated at all. Should we copy it in this case?
>>
>
> I am not really clear on if either ZERO or DATA are correct in the case
> where we do not have a backing file, because maybe this depends on
> has_zero_init?
>
> If we are copying uninitialized data when has_zero_init is true on the
> source, we want zeroes on the target. If the target also has_zero_init,
> we can just skip this sector. If it doesn't, we want to copy zeroes.
>
> If has_zero_init is false and we have unallocated data on the source...
> what are we doing? Copying random debris?
Probably. Sounds fine to me, though. Because if you were to read from
the source I'd expect you'd read random debris, so it's fine to write
that to the destination, too.
Alternatively, we might want to add a new status BLK_UNALLOCATED which
would simply skip both reading and writing these areas.
Alas! my craving does not suffice to compel my lowly self to excogitate
a patch.
Max
> I'm pretty confused, but I'm pretty sure your patch doesn't actually
> change anything, so:
>
> Reviewed-by: John Snow <jsnow@redhat.com>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 512 bytes --]
next prev parent reply other threads:[~2017-04-26 20:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-07 11:34 [Qemu-devel] [PATCH] qemu-img: improve convert_iteration_sectors() Vladimir Sementsov-Ogievskiy
2017-04-19 23:06 ` [Qemu-devel] [Qemu-block] " John Snow
2017-04-26 20:56 ` Max Reitz [this message]
2017-04-26 20:48 ` [Qemu-devel] " Max Reitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ff7ac681-72ae-6b9d-dbe8-ca3f224bbce8@redhat.com \
--to=mreitz@redhat.com \
--cc=den@openvz.org \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).