From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47679) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFm2J-0003vC-AL for qemu-devel@nongnu.org; Wed, 22 Jun 2016 13:34:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFm2I-0001Xx-5M for qemu-devel@nongnu.org; Wed, 22 Jun 2016 13:33:59 -0400 References: <1465939839-30097-1-git-send-email-eblake@redhat.com> <1465939839-30097-9-git-send-email-eblake@redhat.com> <20160621132719.GF4520@noname.redhat.com> <5769BCE7.3030505@redhat.com> <20160622100532.GC6134@noname.redhat.com> From: Eric Blake Message-ID: <576ACC02.3000402@redhat.com> Date: Wed, 22 Jun 2016 11:33:54 -0600 MIME-Version: 1.0 In-Reply-To: <20160622100532.GC6134@noname.redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="guIhTk9Dg3SaLOlng6v8MuP7uUtfaanTN" Subject: Re: [Qemu-devel] [PATCH v2 08/17] blkdebug: Set request_alignment during .bdrv_refresh_limits() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, Max Reitz This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --guIhTk9Dg3SaLOlng6v8MuP7uUtfaanTN From: Eric Blake To: Kevin Wolf Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, Max Reitz Message-ID: <576ACC02.3000402@redhat.com> Subject: Re: [PATCH v2 08/17] blkdebug: Set request_alignment during .bdrv_refresh_limits() References: <1465939839-30097-1-git-send-email-eblake@redhat.com> <1465939839-30097-9-git-send-email-eblake@redhat.com> <20160621132719.GF4520@noname.redhat.com> <5769BCE7.3030505@redhat.com> <20160622100532.GC6134@noname.redhat.com> In-Reply-To: <20160622100532.GC6134@noname.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/22/2016 04:05 AM, Kevin Wolf wrote: >>>> /* Set request alignment */ >>>> - align =3D qemu_opt_get_size(opts, "align", bs->request_alignmen= t); >>>> - if (align > 0 && align < INT_MAX && !(align & (align - 1))) { >>>> - bs->request_alignment =3D align; >>>> + align =3D qemu_opt_get_size(opts, "align", >>>> + bs->request_alignment ?: BDRV_SECTOR_= SIZE); >>> >>> I think you should either just unconditionally use BDRV_SECTOR_SIZE o= r >>> even better just store 0 in s->align if the option isn't given. Your >>> implementation of blkdebug_refresh_limits() already leaves the defaul= t >>> bs->request_alignment alone if s->align =3D=3D 0. >> >> I like that idea; I guess that means I instead need to tweak the logic= >> to test if "align" is present in opts (in which case it must be >> non-zero), or absent (in which case leaving things as 0 is a nicer >> approach than trying to guess which default to stick things to). >=20 > Except that you don't have to check all of that explicitly, the default= > value for absent options is what the third parameter is for: >=20 > align =3D qemu_opt_get_size(opts, "align", 0); Previously, we explicitly reject the user passing in an explicit 'align':0. If I go with this approach of 0 as the default, then I may need to tweak docs. But that sounds better, so I'll try it. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --guIhTk9Dg3SaLOlng6v8MuP7uUtfaanTN Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXaswCAAoJEKeha0olJ0NqmXQH/iTxdrd/P0yAhDo8LdTH0O0G k9Lx2cayKA/EsvAS3rNeU7dlRsZ5aObp7ywSOG2+eFXqBzLigPSG1TPV934eVaDl dyt3rd4i/otMCI03JVuPZ6bOzuAhWoHjLCliYhmLeGeOHomDu8TQqMeMQlU+2nYl +HIe5KCu1FZnnAiDth1FDgF0dAMMZH1HOxnEW3xrGJU1+hxQZ5QPBr+j/rxPe0h4 M6uplLz7Hqr8w991YbHfYKm3KZSEsHbI1vgC7ZIQDYW500rbgnUunR1tPd2Eqobb uj0iRtTuxJGCtvuJvXDYBJVzFv2G8FLG4HQ9DrCqcsyQBNBXZR2L3XbQqg72db0= =3pfe -----END PGP SIGNATURE----- --guIhTk9Dg3SaLOlng6v8MuP7uUtfaanTN--