From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56186) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMFMt-0002be-Jd for qemu-devel@nongnu.org; Fri, 13 Feb 2015 07:29:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YMFMo-0001i3-3B for qemu-devel@nongnu.org; Fri, 13 Feb 2015 07:29:11 -0500 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:37106) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMFMn-0001hT-QF for qemu-devel@nongnu.org; Fri, 13 Feb 2015 07:29:06 -0500 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 13 Feb 2015 12:29:03 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id EA7911B0804B for ; Fri, 13 Feb 2015 12:29:10 +0000 (GMT) Received: from d06av07.portsmouth.uk.ibm.com (d06av07.portsmouth.uk.ibm.com [9.149.37.248]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t1DCT0nf65208476 for ; Fri, 13 Feb 2015 12:29:00 GMT Received: from d06av07.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t1DCSxCO028057 for ; Fri, 13 Feb 2015 07:29:00 -0500 Message-ID: <54DDEE0A.3020103@linux.vnet.ibm.com> Date: Fri, 13 Feb 2015 15:28:58 +0300 From: Ekaterina Tumanova MIME-Version: 1.0 References: <1421678101-44779-1-git-send-email-tumanova@linux.vnet.ibm.com> <1421678101-44779-6-git-send-email-tumanova@linux.vnet.ibm.com> <54DDECDB.5000507@de.ibm.com> In-Reply-To: <54DDECDB.5000507@de.ibm.com> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v6 5/5] BlockConf: Call backend functions to detect geometry and blocksizes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christian Borntraeger , Public KVM Mailing List Cc: kwolf@redhat.com, thuth@linux.vnet.ibm.com, armbru@redhat.com, mihajlov@linux.vnet.ibm.com, dahi@linux.vnet.ibm.com, stefanha@redhat.com, cornelia.huck@de.ibm.com, pbonzini@redhat.com On 02/13/2015 03:23 PM, Christian Borntraeger wrote: > Am 19.01.2015 um 15:35 schrieb Ekaterina Tumanova: >> geometry: hd_geometry_guess function autodetects the drive geometry. >> This patch adds a block backend call, that probes the backing device >> geometry. If the inner driver method is implemented and succeeds >> (currently only for DASDs), the blkconf_geometry will pass-through >> the backing device geometry. Otherwise will fallback to old logic. >> >> blocksize: This patch initializes blocksize properties to 0. >> In order to set the properly a blkconf_blocksizes was introduced. >> If user didn't set physical or logical blocksize, it will >> retrieve its value from a driver (which will return a default 512 for >> any backend but DASD). >> >> The blkconf_blocksizes call was added to all users of BlkConf. >> >> Signed-off-by: Ekaterina Tumanova >> Reviewed-by: Markus Armbruster >> --- >> hw/block/block.c | 20 ++++++++++++++++++++ >> hw/block/hd-geometry.c | 10 +++++++++- >> hw/block/nvme.c | 1 + >> hw/block/virtio-blk.c | 1 + >> hw/core/qdev-properties.c | 3 ++- >> hw/ide/qdev.c | 1 + >> hw/scsi/scsi-disk.c | 1 + >> hw/usb/dev-storage.c | 1 + >> include/hw/block/block.h | 5 +++-- >> include/hw/qdev-properties.h | 4 ++-- >> 10 files changed, 41 insertions(+), 6 deletions(-) >> >> diff --git a/hw/block/block.c b/hw/block/block.c >> index a625773..09dd5f1 100644 >> --- a/hw/block/block.c >> +++ b/hw/block/block.c >> @@ -25,6 +25,26 @@ void blkconf_serial(BlockConf *conf, char **serial) >> } >> } >> >> +void blkconf_blocksizes(BlockConf *conf) >> +{ >> + BlockBackend *blk = conf->blk; >> + BlockSizes blocksizes; >> + int backend_ret; >> + >> + backend_ret = blk_probe_blocksizes(blk, &blocksizes); >> + /* fill in detected values if they are not defined via qemu command line */ >> + if (!conf->physical_block_size && !backend_ret) { >> + conf->physical_block_size = blocksizes.phys; >> + } else { >> + conf->physical_block_size = BDRV_SECTOR_SIZE; >> + } >> + if (!conf->logical_block_size && !backend_ret) { >> + conf->logical_block_size = blocksizes.log; >> + } else { >> + conf->logical_block_size = BDRV_SECTOR_SIZE; >> + } > > When we are going to fix this, I found another bug: > > This code will fail when logical_block_size and physical_block_size are given at the command line AND detection (backend_ret != 0) did not work. It will use BDRV_SECTOR_SIZE instead of the command line value. > With something like > > --- a/hw/block/block.c > +++ b/hw/block/block.c > @@ -33,15 +33,19 @@ void blkconf_blocksizes(BlockConf *conf) > > backend_ret = blk_probe_blocksizes(blk, &blocksizes); > /* fill in detected values if they are not defined via qemu command line */ > - if (!conf->physical_block_size && !backend_ret) { > - conf->physical_block_size = blocksizes.phys; > - } else { > - conf->physical_block_size = BDRV_SECTOR_SIZE; > + if (!conf->physical_block_size) { > + if (!backend_ret) { > + conf->physical_block_size = blocksizes.phys; > + } else { > + conf->physical_block_size = BDRV_SECTOR_SIZE; > + } > } > - if (!conf->logical_block_size && !backend_ret) { > - conf->logical_block_size = blocksizes.log; > - } else { > - conf->logical_block_size = BDRV_SECTOR_SIZE; > + if (!conf->logical_block_size) { > + if (!backend_ret) { > + conf->logical_block_size = blocksizes.log; > + } else { > + conf->logical_block_size = BDRV_SECTOR_SIZE; > + } > } > } > > > No? > yes. will be fix in v7.