From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WR0ma-000226-KV for qemu-devel@nongnu.org; Fri, 21 Mar 2014 10:50:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WR0mW-0002XY-8d for qemu-devel@nongnu.org; Fri, 21 Mar 2014 10:50:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61019) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WR0mV-0002XG-N9 for qemu-devel@nongnu.org; Fri, 21 Mar 2014 10:50:48 -0400 Message-ID: <532C51BA.5030808@redhat.com> Date: Fri, 21 Mar 2014 08:50:34 -0600 From: Eric Blake MIME-Version: 1.0 References: <1395412589-30601-1-git-send-email-pl@kamp.de> In-Reply-To: <1395412589-30601-1-git-send-email-pl@kamp.de> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="MJoxdk5tL0IwUXKTTiwMll1WWGD3Exxc7" Subject: Re: [Qemu-devel] [RFC PATCHv2] block: optimize zero writes with bdrv_write_zeroes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Lieven , qemu-devel@nongnu.org Cc: kwolf@redhat.com, pbonzini@redhat.com, famz@redhat.com, stefanha@redhat.com, mreitz@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --MJoxdk5tL0IwUXKTTiwMll1WWGD3Exxc7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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. >=20 > this should significantly speed up file system initialization and > should speed zero write test used to test backend storage performance. >=20 > the difference can simply be tested by e.g. >=20 > dd if=3D/dev/zero of=3D/dev/vdX bs=3D1M >=20 > Signed-off-by: Peter Lieven > --- > v1->v2: - add detect-zeroes=3Doff|on|unmap knob to drive cmdline parame= ter > - call zero detection only for format (bs->file !=3D NULL) >=20 > +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 =3D BDRV_DETECT_ZEROES_OFF; This parses "offer" > + } else if (!strncmp(detect_zeroes, "on", 2)) { > + bs->detect_zeroes =3D BDRV_DETECT_ZEROES_ON; and this parses "onto". > + } else if (!strncmp(detect_zeroes, "unmap", 5)) { > + bs->detect_zeroes =3D 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=3D@var{detect-zeroes} > +@var{detect-zeroes} is "off", "on" or "unmap" and enables the automati= c > +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/ --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --MJoxdk5tL0IwUXKTTiwMll1WWGD3Exxc7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTLFG6AAoJEKeha0olJ0NqpZEIAJxUYXSSBybacatJgIElWxWh rUbYSRMmETMGJuOdxlpcGWEFZnMrsBgkHvhyfA17h07z/pEaa+fua9xihQ4PhV7I E6LyE3ub8oS3VbaufvE4H75V4ii/9CYs2bfTiPs2liRmNpwWMh1pH4TA7zm9iYdq jHUJdOf2Mcydp1wudWfm4chrp9Lezg77nuztCc45E/mOj9jUKsqiBU29cdeTvfNs ioFclhfX8Uavadp+vF0s8NB2g7Cmo1kTEgyLpolABj3m8UsFczgZ5QfigGrBm+JB Y0GAiSXlNiOKf/Ny36z/u3QAnhPR8nNQjd6N9XcS+xigxMcjqhLC3N4RbUeW0FQ= =3Wsc -----END PGP SIGNATURE----- --MJoxdk5tL0IwUXKTTiwMll1WWGD3Exxc7--