From: Peter Lieven <pl@kamp.de>
To: Max Reitz <mreitz@redhat.com>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH V2] qemu-img: optimize is_allocated_sectors_min
Date: Mon, 23 Jan 2017 16:20:54 +0100 [thread overview]
Message-ID: <c79c63af-213e-43ec-d4da-2a6ec61762a3@kamp.de> (raw)
In-Reply-To: <a9fa5294-acbe-a034-febb-a149dfe320f8@redhat.com>
Am 21.01.2017 um 20:58 schrieb Max Reitz:
> On 19.01.2017 17:35, Peter Lieven wrote:
>> the current implementation always splits requests if a buffer
>> begins or ends with zeroes independent of the length of the
>> zero area. Change this to really only split off zero areas
>> that have at least a length of 'min' bytes.
>>
>> Signed-off-by: Peter Lieven <pl@kamp.de>
>> ---
>> qemu-img.c | 44 ++++++++++++++------------------------------
>> 1 file changed, 14 insertions(+), 30 deletions(-)
> That is because the idea is that you should delay the write operation as
> much as possible. Say you have some empty space at the beginning of the
> buffer and then some used space. Of course you should then only start
> writing at the point where you actually have to write something. The
> same goes for the end of the buffer. Why write zeroes when you can just
> not do it?
>
> On the other hand, it makes sense to not split a single write operation
> into two just because there is some empty space in the middle. This is
> because just writing that empty space may take less time than issuing
> two operations, especially if that empty space is e.g. in the middle of
> a qcow2 cluster anyway.
>
> This is why empty space in the middle is treated differently than empty
> space at the beginning or the end of the buffer.
>
> Do you have a reason for changing this other than because it simplifies
> the code? Which it does, admittedly, but I think the code does have a
> reason for being how it is.
Hi Max,
thanks for looking into this. I was wrong about my analysis what was
going on with a problem I tried to track down. After your explanation
I think the current implementation is fine and it makes perfect sense
to cut off leading and trailing zeroes.
Peter
prev parent reply other threads:[~2017-01-23 15:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-19 16:35 [Qemu-devel] [PATCH V2] qemu-img: optimize is_allocated_sectors_min Peter Lieven
2017-01-21 19:58 ` Max Reitz
2017-01-23 15:20 ` Peter Lieven [this message]
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=c79c63af-213e-43ec-d4da-2a6ec61762a3@kamp.de \
--to=pl@kamp.de \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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).