From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1Z67-0006DT-7G for qemu-devel@nongnu.org; Thu, 18 Dec 2014 06:18:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y1Z5y-0003Nr-4e for qemu-devel@nongnu.org; Thu, 18 Dec 2014 06:18:23 -0500 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:33944) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1Z5x-0003MC-RC for qemu-devel@nongnu.org; Thu, 18 Dec 2014 06:18:14 -0500 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Dec 2014 11:18:10 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id AEF2B2190045 for ; Thu, 18 Dec 2014 11:17:37 +0000 (GMT) Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id sBIBI7ml38076594 for ; Thu, 18 Dec 2014 11:18:07 GMT Received: from d06av11.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id sBIBI6UN020270 for ; Thu, 18 Dec 2014 04:18:07 -0700 From: Ekaterina Tumanova Date: Thu, 18 Dec 2014 12:17:59 +0100 Message-Id: <1418901484-12988-1-git-send-email-tumanova@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v5 0/5] Geometry and blocksize detection for backing devices. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Public KVM Mailing List Cc: kwolf@redhat.com, thuth@linux.vnet.ibm.com, dahi@linux.vnet.ibm.com, Ekaterina Tumanova , armbru@redhat.com, mihajlov@linux.vnet.ibm.com, borntraeger@de.ibm.com, stefanha@redhat.com, cornelia.huck@de.ibm.com, pbonzini@redhat.com Updates v4 -> v5: Minor Updates according the last review from Markus: 1. update commit message for patch 2 2. fix comment typos 3. fix check_for_dasd to return -1 instead of -ENOTSUP Thanks, Kate. --------------------------------------------------------------- Patchset Description (didn't change): Proper geometry and blocksize information is vital for support of DASD/ECKD drives in Linux guests. Otherwise things will fail in certain cases. The existing geometry and blocksize qemu defaults have no sense for DASD drives (hd_geometry_guess detection and 512 for sizes). Setting this information manually in XML file is far from user-friendly, as the admin has to manually look up the properties of the host disks and then modify the guest definition accordingly. Since Linux uses DASDs as normal block devices, we actually want to use virtio-blk to pass those to KVM guests. In order to avoid any change in behavior of other drives, the DASD special casing was advised. We call ioctl BIODASDINFO2 on the block device, which will only succeed if the device is really a DASD. In order to retrieve the underlying device geometry and blocksizes a new block-backend functions and underlying driver functions were introduced (blk_probe_blocksizes anf blk_probe_geometry wrappers and corresponding bdrv_xxxxxx functions). As for now only "host_device" driver received new detection methods. For "raw" we call childs method as usual. In future one may update other drivers to add some other detection heuristics. If the host_device appears to be a DASD, the driver functions (hdev_probe_blocksizes and hdev_probe_geometry) will call certain ioctls in order to detect geometry and blocksizes of the underlying device. if probing failed bdrv_probe_blocksizes caller will set defaults, and bdrv_probe_geometry will fail to allow fallback to old detection logic. The front-end (BlockConf API) was updated: 1. a new blkconf_blocksizes function was added. It doesn't change user-defined blocksize values. If properties are unset, it will set values, returned by blk_probe_backend. In order to allow this logic, blocksize properties were initialized with 0. (driver will return 512 if backing device probing didn't succeed or if driver method is not defined). 2. hd_geometry guess was changed to firstly try to retrieve values via blk_probe_geometry and if it fails, fallback to the old logic. Ekaterina Tumanova (5): block: add bdrv functions for geometry and blocksize raw-posix: Refactor logical block size detection. block: Add driver methods to probe blocksizes and geometry block-backend: Add wrappers for blocksizes and geometry probing BlockConf: Call backend functions to detect geometry and blocksizes block.c | 35 +++++++++++ block/block-backend.c | 10 +++ block/raw-posix.c | 138 ++++++++++++++++++++++++++++++++++++----- block/raw_bsd.c | 14 +++++ hw/block/block.c | 15 +++++ 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/block/block.h | 13 ++++ include/block/block_int.h | 15 +++++ include/hw/block/block.h | 5 +- include/sysemu/block-backend.h | 2 + 16 files changed, 244 insertions(+), 21 deletions(-) -- 1.8.5.5