From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPbwE-0006Tt-W8 for qemu-devel@nongnu.org; Wed, 02 May 2012 11:58:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SPbw7-0004No-Fh for qemu-devel@nongnu.org; Wed, 02 May 2012 11:57:58 -0400 Received: from e06smtp13.uk.ibm.com ([195.75.94.109]:55922) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPbw7-0004L2-6p for qemu-devel@nongnu.org; Wed, 02 May 2012 11:57:51 -0400 Received: from /spool/local by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 2 May 2012 16:57:23 +0100 Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q42FvKqT2719790 for ; Wed, 2 May 2012 16:57:20 +0100 Received: from d06av10.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q42Fqgqp017981 for ; Wed, 2 May 2012 11:52:42 -0400 Message-ID: <4FA1595E.40400@linux.vnet.ibm.com> Date: Wed, 02 May 2012 17:57:18 +0200 From: Stefan Weinhuber MIME-Version: 1.0 References: <1ec34b9b-f63c-4d11-ab0b-4a8a48920561@zmail13.collab.prod.int.phx2.redhat.com> <4FA12E6E.9040004@suse.de> <4FA1446C.6020904@de.ibm.com> In-Reply-To: <4FA1446C.6020904@de.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/3] geometry detection: use HDIO_GETGEO List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christian Borntraeger Cc: Heinz Graalfs , Alexander Graf , qemu-devel , Jens Freimann , Cornelia Huck , Paolo Bonzini , Einar Lueck On 2012-05-02 16:27, Christian Borntraeger wrote: > On 02/05/12 14:54, Alexander Graf wrote: >> On 05/02/2012 01:38 PM, Paolo Bonzini wrote: >>>> On 05/02/2012 01:26 PM, Paolo Bonzini wrote: >>>>>> and everyone should be happy :). I would really like to have as >>>>>> little #ifdef TARGET_S390 code in QEMU. And #ifdef __s390__ is >>>>>> even worse, >>>>>> as it means we won't be able to execise that code path on other >>>>>> architectures. >>>>> True, but how do you exercise that code path with DASD geometry >>>>> on !__s390__? >>>> If we make things a flag for the guessing code, it should work just >>>> as well with image files, right? >>> Only when they're not blank. :) I was only thinking of #ifdef __s390__ >>> for the call to HDIO_GETGEO. >> >> Well, if guessing is a function >> >> guess_size(disk_size, block_size) >> >> then we would be able to do the same on an image file. Christian, would that work? > > I think that the geometry values can not always be guessed correctly based on > block_size and disk_size. > > Stefan, can you clarify that? > > If we cannot reliably guess the geometry based on blocksize and size, I still think > that we should use the host values, e.g. after checking that BIODASDINFO2 returns > successfully. If we know the device type (e.g. 3390) and the block_size, then we can compute the number of blocks per track. The number of tracks per cylinder is a given (15) and the number of cylinders can be computed from these numbers and the disk_size. How do we get the device type? I think we could get away with restricting ECKD DASDs to type 3390, but even then, how would we distinguish an ECKD DASD from anything else, e.g. a SCSI device? We could simply attempt the above cylinder calculation for every device and if we get a result without a remainder we just assume that we have a DASD. This could lead to false positives, but maybe that is acceptable? Stefan Weinhuber