From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37797) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC6VI-0005S2-UQ for qemu-devel@nongnu.org; Tue, 29 Jul 2014 08:27:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XC6VA-0006Ag-L4 for qemu-devel@nongnu.org; Tue, 29 Jul 2014 08:27:40 -0400 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:37397) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC6VA-000697-By for qemu-devel@nongnu.org; Tue, 29 Jul 2014 08:27:32 -0400 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 29 Jul 2014 13:27:31 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 377E91B08040 for ; Tue, 29 Jul 2014 13:28:14 +0100 (BST) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps3075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s6TCRS4F34865258 for ; Tue, 29 Jul 2014 12:27:28 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s6TCRRSn005765 for ; Tue, 29 Jul 2014 06:27:27 -0600 From: Ekaterina Tumanova Date: Tue, 29 Jul 2014 14:27:19 +0200 Message-Id: <1406636839-11946-5-git-send-email-tumanova@linux.vnet.ibm.com> In-Reply-To: <1406636839-11946-1-git-send-email-tumanova@linux.vnet.ibm.com> References: <1406636839-11946-1-git-send-email-tumanova@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 4/4] blocksize: add blkconf_blocksize call to all block devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Public KVM Mailing List Cc: cornelia.huck@de.ibm.com, dahi@linux.vnet.ibm.com, Ekaterina Tumanova , borntraeger@de.ibm.com This patch add the blkconf_blocksize call to all devices, which use DEFINE_BLOCK_PROPERTIES. If the underlying driver function fails, blkconf_blocksizes will set blocksizes to default (512) value. Signed-off-by: Ekaterina Tumanova Reviewed-by: David Hildenbrand Acked-by: Cornelia Huck --- hw/block/nvme.c | 1 + hw/block/virtio-blk.c | 1 + hw/ide/qdev.c | 1 + hw/scsi/scsi-disk.c | 1 + hw/usb/dev-storage.c | 1 + include/hw/block/block.h | 4 ++-- 6 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 5fd8f89..50fe769 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -761,6 +761,7 @@ static int nvme_init(PCIDevice *pci_dev) if (!n->serial) { return -1; } + blkconf_blocksizes(&n->conf); pci_conf = pci_dev->config; pci_conf[PCI_INTERRUPT_PIN] = 1; diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index c241c50..b5027b1 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -743,6 +743,7 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp) } blkconf_serial(&blk->conf, &blk->serial); + blkconf_blocksizes(&blk->conf); s->original_wce = bdrv_enable_write_cache(blk->conf.bs); if (blkconf_geometry(&blk->conf, NULL, 65535, 255, 255) < 0) { error_setg(errp, "Error setting geometry"); diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 6e475e6..6d94d8f 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -161,6 +161,7 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind) } blkconf_serial(&dev->conf, &dev->serial); + blkconf_blocksizes(&dev->conf); if (kind != IDE_CD && blkconf_geometry(&dev->conf, &dev->chs_trans, 65536, 16, 255) < 0) { return -1; diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index d47ecd6..bfae48b 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2250,6 +2250,7 @@ static int scsi_initfn(SCSIDevice *dev) } blkconf_serial(&s->qdev.conf, &s->serial); + blkconf_blocksizes(&s->qdev.conf); if (dev->type == TYPE_DISK && blkconf_geometry(&dev->conf, NULL, 65535, 255, 255) < 0) { return -1; diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index ae4efcb..cf50ac1 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -603,6 +603,7 @@ static int usb_msd_initfn_storage(USBDevice *dev) } blkconf_serial(&s->conf, &dev->serial); + blkconf_blocksizes(&s->conf); /* * Hack alert: this pretends to be a block device, but it's really diff --git a/include/hw/block/block.h b/include/hw/block/block.h index 7a0092e..8560bb2 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.bs), \ 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), \ DEFINE_PROP_UINT16("min_io_size", _state, _conf.min_io_size, 0), \ DEFINE_PROP_UINT32("opt_io_size", _state, _conf.opt_io_size, 0), \ DEFINE_PROP_INT32("bootindex", _state, _conf.bootindex, -1), \ -- 1.8.5.5