All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Fam Zheng <famz@redhat.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org,
	Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] qcow2: Support BDRV_REQ_MAY_UNMAP
Date: Thu, 29 Sep 2016 14:56:46 +0200	[thread overview]
Message-ID: <6a3ee157-cd0f-4c00-9a8c-f44950d82a48@redhat.com> (raw)
In-Reply-To: <c70f0bf4-635f-c93f-b03f-98cd61986216@redhat.com>



On 29/09/2016 14:50, Paolo Bonzini wrote:
> 
> 
> On 29/09/2016 14:48, Kevin Wolf wrote:
>> Am 29.09.2016 um 14:14 hat Paolo Bonzini geschrieben:
>>> On 29/09/2016 12:39, Kevin Wolf wrote:
>>>>>> Because there is another check of pass-discard-request value in
>>>>>> update_refcount:
>>>>>>
>>>>>>         if (refcount == 0 && s->discard_passthrough[type]) {
>>>>>>             update_refcount_discard(bs, cluster_offset, s->cluster_size);
>>>>>>         }
>>>> What I mean is that in the second case, you're still uselessly
>>>> deallocating the cluster on the qcow2 level while you can't reclaim it
>>>> on the filesystem level. So it would be better to leave it allocated in
>>>> qcow2, too, so that you don't get an expensive reallocation the next
>>>> time you write to it.
>>>
>>> But if you do a qemu-img convert, the deallocated cluster wouldn't be in
>>> the destination.
>>
>> Right. I still think that there has to be an option to keep the image
>> fully allocated. Perhaps what we really need to check is BDRV_O_UNMAP.
> 
> Duh, of course it is.

... and it's handled in bdrv_co_pwrite_zeroes, so Fam's patch should be
okay:

    if (!(child->bs->open_flags & BDRV_O_UNMAP)) {
        flags &= ~BDRV_REQ_MAY_UNMAP;
    }

    return bdrv_co_pwritev(child, offset, count, NULL,
                           BDRV_REQ_ZERO_WRITE | flags);

Paolo

  reply	other threads:[~2016-09-29 12:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-28  7:04 [Qemu-devel] [PATCH] qcow2: Support BDRV_REQ_MAY_UNMAP Fam Zheng
2016-09-28 16:11 ` Max Reitz
2016-09-29  2:21   ` Fam Zheng
2016-09-29  7:58     ` Paolo Bonzini
2016-09-29  8:10       ` Fam Zheng
2016-10-01 13:08         ` Max Reitz
2016-09-29  9:29 ` Kevin Wolf
2016-09-29  9:55   ` Fam Zheng
2016-09-29 10:39     ` Kevin Wolf
2016-09-29 12:14       ` Paolo Bonzini
2016-09-29 12:48         ` Kevin Wolf
2016-09-29 12:50           ` Paolo Bonzini
2016-09-29 12:56             ` Paolo Bonzini [this message]
2016-09-30  2:04       ` Fam Zheng
2016-09-30 12:38         ` Kevin Wolf
2016-10-12  1:14 ` Fam Zheng
2016-10-12  8:42   ` Kevin Wolf

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=6a3ee157-cd0f-4c00-9a8c-f44950d82a48@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=famz@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.