All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Lieven <pl@kamp.de>, Fam Zheng <famz@redhat.com>,
	qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [RFC PATCH] block: optimize zero writes with bdrv_write_zeroes
Date: Mon, 24 Feb 2014 13:22:47 +0100	[thread overview]
Message-ID: <20140224122247.GH3775@dhcp-200-207.str.redhat.com> (raw)
In-Reply-To: <530B36D2.7040900@redhat.com>

Am 24.02.2014 um 13:10 hat Paolo Bonzini geschrieben:
> Il 24/02/2014 13:07, Kevin Wolf ha scritto:
> >>> Yeah, that's why I wrote "or should be".  Those are the intended
> >>> semantics of bdrv_co_write_zeroes without BDRV_REQ_MAY_UNMAP: always
> >>> allocate a cluster that will read as zeroes (allocating even if it
> >>> does not necessarily write the zeroes).
> >Which would mean that there is no way to say "give me zeroes, and do it
> >in the cheapest way possible". Because that would be to leave the
> >allocation status as it is and just toggle the zero bit.
> 
> If bdrv_co_write_zeroes is SCSI's "WRITE SAME without UNMAP", then
> it must allocate.  I think "give me zeroes and do it in the cheapest
> way possible" is BDRV_REQ_MAY_UNMAP (which *may* unmap but it
> doesn't have to).

Hm, okay. So the intended behaviour for qcow2 is:
- without MAY_UNMAP: Preallocate the cluster and set the zero flag so
  that its content isn't valid
- with MAY_UNMAP: If the cluster is allocated, leave it allocated and
  set the zero flag; if it isn't, leave it unallocated and set the zero
  flag.

> That said, the really expensive part of unmapping is probably
> re-allocating the clusters on subsequent writes.  The unmap itself
> isn't that expensive (even if you have to flush the refcount blocks
> before the L2 tables), is it?

Flushes are pretty expensive. If you only have many discards in a row
and then many allocations in a row, it's probably okay. Mixing them so
that every other write is a discard might well kill performance.

Kevin

  reply	other threads:[~2014-02-24 12:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-22 13:00 [Qemu-devel] [RFC PATCH] block: optimize zero writes with bdrv_write_zeroes Peter Lieven
2014-02-22 16:45 ` Fam Zheng
2014-02-23 19:10   ` Peter Lieven
2014-02-24  1:01     ` Fam Zheng
2014-02-24 10:39       ` Paolo Bonzini
2014-02-24 11:33         ` Fam Zheng
2014-02-24 11:51           ` Paolo Bonzini
2014-02-24 12:04             ` Fam Zheng
2014-02-24 12:07             ` Kevin Wolf
2014-02-24 12:10               ` Paolo Bonzini
2014-02-24 12:22                 ` Kevin Wolf [this message]
2014-02-24 10:11 ` Kevin Wolf
2014-02-24 10:26   ` Peter Lieven
2014-02-24 10:38     ` Paolo Bonzini
2014-02-24 11:50       ` Peter Lieven
2014-02-24 13:01       ` Peter Lieven
2014-02-25 13:41         ` Kevin Wolf
2014-02-25 17:03           ` 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=20140224122247.GH3775@dhcp-200-207.str.redhat.com \
    --to=kwolf@redhat.com \
    --cc=famz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pl@kamp.de \
    --cc=qemu-devel@nongnu.org \
    --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 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.