qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Lieven <pl@kamp.de>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	ronniesahlberg@gmail.com, qemu-devel@nongnu.org,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 6/8] qemu-img: use bdrv_write_zeroes to write zeroes
Date: Mon, 24 Jun 2013 20:46:38 +0200	[thread overview]
Message-ID: <51C8940E.9010508@kamp.de> (raw)
In-Reply-To: <51C872FA.9060404@redhat.com>

Am 24.06.2013 18:25, schrieb Paolo Bonzini:
> Il 24/06/2013 18:17, Peter Lieven ha scritto:
>> Am 24.06.2013 16:33, schrieb Paolo Bonzini:
>>> Il 22/06/2013 22:58, Peter Lieven ha scritto:
>>>> Signed-off-by: Peter Lieven <pl@kamp.de>
>>>> ---
>>>>  qemu-img.c |   10 +++++++---
>>>>  1 file changed, 7 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/qemu-img.c b/qemu-img.c
>>>> index 809b4f1..5aa53ab 100644
>>>> --- a/qemu-img.c
>>>> +++ b/qemu-img.c
>>>> @@ -1513,9 +1513,13 @@ static int img_convert(int argc, char **argv)
>>>>                     If the output is to a host device, we also write out
>>>>                     sectors that are entirely 0, since whatever data was
>>>>                     already there is garbage, not 0s. */
>>>> -                if (!has_zero_init || out_baseimg ||
>>>> -                    is_allocated_sectors_min(buf1, n, &n1, min_sparse)) {
>>>> -                    ret = bdrv_write(out_bs, sector_num, buf1, n1);
>>>> +                int allocated = is_allocated_sectors_min(buf1, n, &n1, min_sparse);
>>>> +                if (!has_zero_init || out_baseimg || allocated) {
>>>> +                    if (allocated || out_baseimg) {
>>>> +                        ret = bdrv_write(out_bs, sector_num, buf1, n1);
>>>> +                    } else {
>>>> +                        ret = bdrv_write_zeroes(out_bs, sector_num, n1);
>>> I think it should still do the write only if !has_zero_init.
>> With this I am still in trouble with iSCSI, but Kevin pointed out another
>> possible solution for the allocating everything problem.
>>
>> a) let iscsi_create discard the whole device if lbpz && lbprz
>> b) return 1 for has_zero_init if lbprz.
>>
>> What do you think?
> Fine by me (but the discard may take a looong time! :)).
fyi: i have created an optimized unmap function which transmits the
maximum allowed unmap_list length (read from block_limits page).

for 1TB it takes approx. 1 minute on my storage.

i will include this in v2 of the series and also add the optimization
to the other unmap calls (which currently do not check max_unmap
size at all).

Peter

  parent reply	other threads:[~2013-06-24 18:46 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-22 20:58 [Qemu-devel] [PATCH 0/8] iscsi/qemu-img/block-migration enhancements Peter Lieven
2013-06-22 20:58 ` [Qemu-devel] [PATCH 1/8] iscsi: add logical block provisioning information to iscsilun Peter Lieven
2013-06-24 14:35   ` Paolo Bonzini
2013-06-22 20:58 ` [Qemu-devel] [PATCH 2/8] iscsi: add bdrv_co_is_allocated Peter Lieven
2013-06-24 14:36   ` Paolo Bonzini
2013-06-22 20:58 ` [Qemu-devel] [PATCH 3/8] iscsi: add bdrv_co_write_zeroes Peter Lieven
2013-06-24 14:34   ` Paolo Bonzini
2013-06-24 16:31     ` Peter Lieven
2013-06-22 20:58 ` [Qemu-devel] [PATCH 4/8] block: add bdrv_write_zeroes() Peter Lieven
2013-06-22 20:58 ` [Qemu-devel] [PATCH 5/8] block/raw: add bdrv_co_write_zeroes Peter Lieven
2013-06-22 20:58 ` [Qemu-devel] [PATCH 6/8] qemu-img: use bdrv_write_zeroes to write zeroes Peter Lieven
2013-06-24 14:33   ` Paolo Bonzini
2013-06-24 16:17     ` Peter Lieven
2013-06-24 16:25       ` Paolo Bonzini
2013-06-24 16:33         ` Peter Lieven
2013-06-24 18:46         ` Peter Lieven [this message]
2013-06-22 20:58 ` [Qemu-devel] [PATCH 7/8] iscsi: assert that sectors are aligned to LUN blocksize Peter Lieven
2013-06-24 14:30   ` Paolo Bonzini
2013-06-24 16:10     ` Peter Lieven
2013-06-24 16:13       ` Paolo Bonzini
2013-06-24 16:24         ` Peter Lieven
2013-06-24 16:27           ` Paolo Bonzini
2013-06-24 16:36             ` Peter Lieven
2013-06-22 20:58 ` [Qemu-devel] [PATCH 8/8] block-migration: efficiently encode zero blocks Peter Lieven
2013-06-24 14:32   ` Paolo Bonzini
2013-06-24 16:14     ` Peter Lieven

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=51C8940E.9010508@kamp.de \
    --to=pl@kamp.de \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=stefanha@redhat.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).