From: Eric Blake <eblake@redhat.com>
To: Peter Lieven <pl@kamp.de>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, pbonzini@redhat.com, famz@redhat.com,
stefanha@redhat.com, mreitz@redhat.com
Subject: Re: [Qemu-devel] [RFC PATCHv2] block: optimize zero writes with bdrv_write_zeroes
Date: Fri, 21 Mar 2014 08:50:34 -0600 [thread overview]
Message-ID: <532C51BA.5030808@redhat.com> (raw)
In-Reply-To: <1395412589-30601-1-git-send-email-pl@kamp.de>
[-- Attachment #1: Type: text/plain, Size: 2020 bytes --]
On 03/21/2014 08:36 AM, Peter Lieven wrote:
> this patch tries to optimize zero write requests
> by automatically using bdrv_write_zeroes if it is
> supported by the format.
>
> this should significantly speed up file system initialization and
> should speed zero write test used to test backend storage performance.
>
> the difference can simply be tested by e.g.
>
> dd if=/dev/zero of=/dev/vdX bs=1M
>
> Signed-off-by: Peter Lieven <pl@kamp.de>
> ---
> v1->v2: - add detect-zeroes=off|on|unmap knob to drive cmdline parameter
> - call zero detection only for format (bs->file != NULL)
>
> +static int bdrv_set_detect_zeroes(BlockDriverState *bs,
> + const char *detect_zeroes,
> + Error **errp)
> +{
> + if (!detect_zeroes || !strncmp(detect_zeroes, "off", 3)) {
> + bs->detect_zeroes = BDRV_DETECT_ZEROES_OFF;
This parses "offer"
> + } else if (!strncmp(detect_zeroes, "on", 2)) {
> + bs->detect_zeroes = BDRV_DETECT_ZEROES_ON;
and this parses "onto".
> + } else if (!strncmp(detect_zeroes, "unmap", 5)) {
> + bs->detect_zeroes = BDRV_DETECT_ZEROES_UNMAP;
In all three cases, shouldn't you be using strcmp() instead of strncmp()?
> + } else {
> + error_setg(errp, "invalid value for detect-zeroes: %s",
> + detect_zeroes);
Especially since you warn about other unknown spellings, it feels weird
to not warn about the spellings where the prefix matches but the overall
spelling is unknown.
> file sectors into the image file.
> +@item detect-zeroes=@var{detect-zeroes}
> +@var{detect-zeroes} is "off", "on" or "unmap" and enables the automatic
> +conversion of plain zero writes by the OS to driver specific optimized
> +zero write commands. If "unmap" is choosen and @var{discard} is "on"
s/choosen/chosen/
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2014-03-21 14:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-21 14:36 [Qemu-devel] [RFC PATCHv2] block: optimize zero writes with bdrv_write_zeroes Peter Lieven
2014-03-21 14:50 ` Eric Blake [this message]
2014-03-21 20:20 ` Peter Lieven
2014-03-26 9:16 ` Markus Armbruster
2014-03-27 13:06 ` Peter Lieven
2014-03-27 14:07 ` Markus Armbruster
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=532C51BA.5030808@redhat.com \
--to=eblake@redhat.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@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 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).