From: Peter Lieven <pl@kamp.de>
To: Eric Blake <eblake@redhat.com>, 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 21:20:11 +0100 [thread overview]
Message-ID: <532C9EFB.9040206@kamp.de> (raw)
In-Reply-To: <532C51BA.5030808@redhat.com>
Am 21.03.2014 15:50, schrieb Eric Blake:
> 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()?
yes, you are right.
Thanks,
Peter
>
>> + } 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/
>
next prev parent reply other threads:[~2014-03-21 20:20 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
2014-03-21 20:20 ` Peter Lieven [this message]
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=532C9EFB.9040206@kamp.de \
--to=pl@kamp.de \
--cc=eblake@redhat.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--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).