]> git.ipfire.org Git - thirdparty/qemu.git/commit
virtio-blk: Fix geometry sector calculation
authorChristian Borntraeger <borntraeger@de.ibm.com>
Thu, 24 May 2012 11:22:55 +0000 (13:22 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 25 Jun 2012 13:47:47 +0000 (08:47 -0500)
commitc63c453889d0bfbd183da686bc076590220fd44a
tree725d0fa09299ad7dad5dbbbeb11e3a2fb28a7961
parent78260a5f085d34e4ae46e42bdc010dfcd6f6cc31
virtio-blk: Fix geometry sector calculation

Currently the sector value for the geometry is masked, even if the
user usesa command line parameter that explicitely gives a number.
This breaks dasd devices on s390. A dasd device can have
a physical block size of 4096 (== same for logical block size)
and a typcial geometry of 15 heads and 12 sectors per cyl.
The ibm partition detection relies on a correct geometry
reported by the device. Unfortunately the current code changes
12 to 8. This would be necessary if the total size is
not a multiple of logical sector size,  but for dasd this
is not the case.

This patch checks the device size and only applies sector
mask if necessary.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
CC: Christoph Hellwig <hch@lst.de>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 136be99e6e2130d3cd960b6b7d0ca86b6f011e5f)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/virtio-blk.c