From: Kevin Wolf <kwolf@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: ronniesahlberg@gmail.com, Peter Lieven <pl@kamp.de>,
qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH 4/4] qemu-img: conditionally discard target on convert
Date: Wed, 17 Jul 2013 12:25:51 +0200 [thread overview]
Message-ID: <20130717102551.GF2458@dhcp-200-207.str.redhat.com> (raw)
In-Reply-To: <51E66ACD.70706@redhat.com>
Am 17.07.2013 um 11:58 hat Paolo Bonzini geschrieben:
> Il 17/07/2013 10:46, Kevin Wolf ha scritto:
> > Am 15.07.2013 um 12:49 hat Peter Lieven geschrieben:
> >> if a destination has has_zero_init = 0, but it supports
> >> discard zeroes use discard to convert the target
> >> into an all zero device.
> >>
> >> Signed-off-by: Peter Lieven <pl@kamp.de>
> >
> > Wouldn't it be better to use bdrv_write_zeroes() and extend the
> > implementation of that to use discard internally in those block drivers
> > where it makes sense?
> >
> > Because here you're not really discarding (i.e. don't care about the
> > sectors any more), but you want them to be zeroed.
>
> I thought the same yesterday when reviewing the series, but I'm not
> convinced.
>
> Discarding is not always the right way to write zeroes, because it can
> disrupt performance. It may be fine when you are already going to write
> a sparse image (as is the case for qemu-img convert), but not in
> general. So if you just used write_zeroes, it would have to fall under
> yet another -drive option (or an extension to "-drive discard").
Maybe we need a flag to bdrv_write_zeroes() that specifies whether to
use discard or not, kind of like the unmap bit in WRITE SAME.
On the other hand, I think you're right that this is really policy,
and as such shouldn't be hardcoded based on our guesses, but be
configurable.
> I think what Peter did is a good compromise in the end.
At the very least it must become a separate function. img_convert() is
already too big and too deeply nested.
> BTW, Peter and Ronnie: we were assuming that UNMAP with LBPRZ=1 always
> zeroes blocks, but is that true for unaligned operations?
SBC-3 Rev. 35e, 5.16 READ CAPACITY (16) command:
"A logical block provisioning read zeros (LBPRZ) bit set to one
indicates that, for read commands specifying an unmapped LBA (see
4.7.4.5), the device server returns user data set to zero [...]"
So it depends on the block provisioning state of the LBA, not on the
operations that were performed on it.
5.28 UNMAP command:
If the ANCHOR bit in the CDB is set to zero, and the logical unit is
thin provisioned (see 4.7.3.3), then the logical block provisioning
state for each specified LBA:
a) should become deallocated;
b) may become anchored; or
c) may remain unchanged.
So with UNMAP, I think you don't have any guarantees that the LBA
becomes unmapped and therefore zeroed. It could just keep its current
data. No matter whether your request was aligned or not.
Kevin
next prev parent reply other threads:[~2013-07-17 10:26 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-15 10:49 [Qemu-devel] [PATCH 0/4] qemu-img: conditionally discard target on convert Peter Lieven
2013-07-15 10:49 ` [Qemu-devel] [PATCH 1/4] block: add discard_zeroes and max_unmap to BlockDriverInfo Peter Lieven
2013-07-15 10:49 ` [Qemu-devel] [PATCH 2/4] iscsi: add .bdrv_get_info Peter Lieven
2013-07-15 10:49 ` [Qemu-devel] [PATCH 3/4] block/raw: " Peter Lieven
2013-07-19 5:12 ` Stefan Hajnoczi
2013-07-15 10:49 ` [Qemu-devel] [PATCH 4/4] qemu-img: conditionally discard target on convert Peter Lieven
2013-07-17 8:46 ` Kevin Wolf
2013-07-17 9:58 ` Paolo Bonzini
2013-07-17 10:21 ` Peter Lieven
2013-07-17 10:27 ` Kevin Wolf
2013-07-17 10:31 ` Peter Lieven
2013-07-17 10:47 ` Paolo Bonzini
2013-07-17 14:19 ` Peter Lieven
2013-07-17 10:45 ` Paolo Bonzini
2013-07-17 14:21 ` Peter Lieven
2013-07-17 14:26 ` Paolo Bonzini
2013-07-17 10:25 ` Kevin Wolf [this message]
2013-07-17 15:54 ` ronnie sahlberg
2013-07-17 16:27 ` Paolo Bonzini
2013-07-17 16:31 ` ronnie sahlberg
2013-07-17 17:02 ` Peter Lieven
2013-07-17 17:04 ` Paolo Bonzini
2013-07-17 17:48 ` Peter Lieven
2013-07-17 20:00 ` Paolo Bonzini
2013-07-18 9:23 ` Kevin Wolf
2013-07-18 10:24 ` Paolo Bonzini
2013-07-18 10:42 ` Kevin Wolf
2013-07-18 10:44 ` Peter Lieven
2013-07-18 10:56 ` Paolo Bonzini
2013-07-18 11:04 ` Peter Lieven
2013-07-18 12:31 ` Paolo Bonzini
2013-07-18 13:29 ` Peter Lieven
2013-07-18 13:52 ` Paolo Bonzini
2013-07-18 14:09 ` Peter Lieven
2013-07-18 14:20 ` Paolo Bonzini
2013-07-18 14:32 ` Peter Lieven
2013-07-18 14:35 ` Paolo Bonzini
2013-07-18 18:43 ` Peter Lieven
2013-07-18 18:54 ` ronnie sahlberg
2013-07-18 19:28 ` Peter Lieven
2013-07-19 5:58 ` Paolo Bonzini
2013-07-19 6:08 ` Peter Lieven
2013-07-19 13:25 ` ronnie sahlberg
2013-07-19 13:49 ` Peter Lieven
2013-07-19 14:00 ` ronnie sahlberg
2013-07-19 14:02 ` Peter Lieven
2013-07-19 13:58 ` ronnie sahlberg
2013-07-18 13:55 ` ronnie sahlberg
2013-07-18 14:14 ` Paolo Bonzini
2013-09-12 8:52 ` Peter Lieven
2013-09-12 8:55 ` Paolo Bonzini
2013-09-12 9:03 ` Peter Lieven
2013-07-17 17:09 ` ronnie sahlberg
2013-07-18 9:21 ` Kevin Wolf
2013-07-17 10:22 ` Peter Lieven
2013-07-16 10:55 ` [Qemu-devel] [PATCH 0/4] " Paolo Bonzini
2013-07-16 11:18 ` Peter Lieven
2013-07-16 11:27 ` Paolo Bonzini
2013-07-16 11:40 ` Peter Lieven
2013-07-16 11:55 ` Paolo Bonzini
2013-07-17 10:23 ` Peter Lieven
2013-07-17 10:28 ` Paolo Bonzini
2013-07-17 10:40 ` Peter Lieven
2013-07-17 10:50 ` Paolo Bonzini
2013-07-17 14:18 ` Peter Lieven
2013-07-17 14:26 ` Paolo Bonzini
2013-07-17 14:46 ` Peter Lieven
2013-07-17 14:53 ` Paolo Bonzini
2013-07-17 15:12 ` Kevin Wolf
2013-07-17 16:53 ` Peter Lieven
2013-07-17 17:01 ` Peter Lieven
2013-07-19 5:13 ` Stefan Hajnoczi
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=20130717102551.GF2458@dhcp-200-207.str.redhat.com \
--to=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=pl@kamp.de \
--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).