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>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	ronnie sahlberg <ronniesahlberg@gmail.com>
Subject: Re: [Qemu-devel] [PATCH 4/4] qemu-img: conditionally discard target on convert
Date: Thu, 18 Jul 2013 16:09:25 +0200	[thread overview]
Message-ID: <51E7F715.3020706@kamp.de> (raw)
In-Reply-To: <51E7F332.9020607@redhat.com>

On 18.07.2013 15:52, Paolo Bonzini wrote:
> Il 18/07/2013 15:29, Peter Lieven ha scritto:
>>>> If the driver would have a better method of writing zeroes than
>>>> discard it simply should not set bdi->write_zeroes_w_discard = 1.
>>> If the driver had a better method of writing zeroes than discard, it
>>> simply should ignore the BDRV_MAY_UNMAP (or BDRV_MAY_DISCARD) flag in
>>> its bdrv_write_zeros implementation.
>> ok, but this would require an individual patch in every driver, wouldn't
>> it.  i am ok with that.
> Yes (making the drivers return the flag in the BDI would also require
> per-driver patches).
we still might need a hint for qemu-img convert that the driver does support
writing zeroes by unmap because using write_zeroes in the main loop
might result in unaligned requests that the target is not able to unmap.
and to avoid writing several blocks twice by first writing all zeroes
to the target and then writing all data blocks again I would need to keep the loop
at the beginning of qemu-img convert to write zeroes with correct
alignment and granularity if the driver supports write_zeroes_w_discard.

>
> BDRV_MAY_UNMAP is an advisory flag, that the driver is free to ignore
> (just like bdrv_discard can be ignored altogether).
>
> block.c probably should avoid passing down BDRV_MAY_UNMAP altogether if
> the BDRV_O_UNMAP flag is not set.
>
>> the BDRV_MAY_DISCARD flag is at the end a hint if the driver can optimize
>> writing zeroes by a discard or if real zeroes should be written e.g. to
>> sanitize the device?
>>
>> talking for iscsi:
>> bdrv->discard can remain to use UNMAP and silently fail if lbpu == 0.
>> bdrv->write_zeroes will use writesame16 and set the unmap flag only if
>> BDRV_MAY_DISCARD == 1 and BDRV_O_UNMAP == 1 and lbprz == 1.
>> in case lbpws == 0 it will return -ENOSUP.
> Almost: for LBPWS == 0 it can use WRITE SAME(16) without the unmap flag.
>   If that doesn't work either it can return -ENOTSUP.
Ok, i was not aware that WRITE SAME(16) is always available.

Peter

  reply	other threads:[~2013-07-18 14:09 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
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 [this message]
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=51E7F715.3020706@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).