From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y71cZ-0004RL-2u for qemu-devel@nongnu.org; Fri, 02 Jan 2015 07:46:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y71cU-0006Ta-3H for qemu-devel@nongnu.org; Fri, 02 Jan 2015 07:46:27 -0500 Received: from mail-we0-x233.google.com ([2a00:1450:400c:c03::233]:40394) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y71cT-0006TR-SC for qemu-devel@nongnu.org; Fri, 02 Jan 2015 07:46:22 -0500 Received: by mail-we0-f179.google.com with SMTP id q59so4444487wes.10 for ; Fri, 02 Jan 2015 04:46:21 -0800 (PST) Date: Fri, 2 Jan 2015 12:46:17 +0000 From: Stefan Hajnoczi Message-ID: <20150102124617.GF10823@stefanha-thinkpad.redhat.com> References: <1418901484-12988-1-git-send-email-tumanova@linux.vnet.ibm.com> <1418901484-12988-6-git-send-email-tumanova@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="eNMatiwYGLtwo1cJ" Content-Disposition: inline In-Reply-To: <1418901484-12988-6-git-send-email-tumanova@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH v5 5/5] BlockConf: Call backend functions to detect geometry and blocksizes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ekaterina Tumanova Cc: kwolf@redhat.com, thuth@linux.vnet.ibm.com, borntraeger@de.ibm.com, armbru@redhat.com, Public KVM Mailing List , mihajlov@linux.vnet.ibm.com, dahi@linux.vnet.ibm.com, stefanha@redhat.com, cornelia.huck@de.ibm.com, pbonzini@redhat.com --eNMatiwYGLtwo1cJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Dec 18, 2014 at 12:18:04PM +0100, Ekaterina Tumanova wrote: > +void blkconf_blocksizes(BlockConf *conf) > +{ > + BlockBackend *blk = conf->blk; > + BlockSizes blocksizes; > + > + blk_probe_blocksizes(blk, &blocksizes); > + /* fill in detected values if they are not defined via qemu command line */ > + if (!conf->physical_block_size) { > + conf->physical_block_size = blocksizes.phys; > + } > + if (!conf->logical_block_size) { > + conf->logical_block_size = blocksizes.log; > + } > +} Please put the 512-byte default value in this function instead of in blk_probe_blocksizes(). That way the .bdrv_probe_blocksizes() error return is not discarded. It also makes .bdrv_probe_blocksizes() and .bdrv_probe_geometry() APIs consistent with each other. Probing geometry doesn't set default geometry either when then block driver does not support probing. > diff --git a/include/hw/block/block.h b/include/hw/block/block.h > index 0d0ce9a..3e502a8 100644 > --- a/include/hw/block/block.h > +++ b/include/hw/block/block.h > @@ -44,9 +44,9 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf) > #define DEFINE_BLOCK_PROPERTIES(_state, _conf) \ > DEFINE_PROP_DRIVE("drive", _state, _conf.blk), \ > DEFINE_PROP_BLOCKSIZE("logical_block_size", _state, \ > - _conf.logical_block_size, 512), \ > + _conf.logical_block_size, 0), \ > DEFINE_PROP_BLOCKSIZE("physical_block_size", _state, \ > - _conf.physical_block_size, 512), \ > + _conf.physical_block_size, 0), \ Please drop the default parameter from the DEFINE_PROP_BLOCKSIZE() macro since it must always be 0 now. --eNMatiwYGLtwo1cJ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJUppMZAAoJEJykq7OBq3PIuZ0IAKSVjPKapy/6Db2RvyvKOPJ4 kLuEkxAHADjsSOCrToD+VBoJo6xIhV8eaD/2Ih0XJF+FcrbpmPhV9/dO5GgGSWvC NoYDUZOSUGGe0Y/2Erw/1meynFgTjp7dEPpUp6Ri4wjksTFn0Ql7WaDiuYdzVgQn qLza8G5q7X3RYShAVTaaFY2NnpMNH2V2C3H2Wkih2XBIJ52vR1aMEKbiKvbQA9LP CToZae9KJO/ikth8wU60T+0HsntRX8ko3rpkIQZttwKJltfxCWDqMQQ65rwD+mcf GcpZJSNX6/CVxn7cv4mrlDVjI5JPkiM9RQdA3twwHEGHXETyxtS7fTCKG4XybPc= =iW94 -----END PGP SIGNATURE----- --eNMatiwYGLtwo1cJ--