Re: [Qemu-devel] [PATCH v6 0/5] Geometry and blocksize detection for backing devices.

2015-02-13 Thread Christian Borntraeger
Am 13.02.2015 um 08:50 schrieb Kevin Wolf:
 Am 12.02.2015 um 17:42 hat Christian Borntraeger geschrieben:
 Am 12.02.2015 um 16:46 schrieb Stefan Hajnoczi:
 On Mon, Jan 19, 2015 at 03:34:56PM +0100, Ekaterina Tumanova wrote:
 Updates v5 - v6:

 Minor Updates according the last review from Stefan Hajnoczi:
 1. Do not change the flow of code, factored out of raw_probe_alignment.
 2. added #ifdef __linux__ in 2 places of raw-posix.c, mentioned by 
 reviewer.
 3. adjusted the comment hdev_probe_geometry according suggestment.
 4. use bdrv_nb_sectors(bs) instead of bs-total_sectors.
 5. do not discard error blk_probe_blocksizes(). now has rc.
 6. put the 512-byte default blocksize value in blkconf_blocksizes.
 7. drop the default parameter from the DEFINE_PROP_BLOCKSIZE() macro.

 Unfortunately this series breaks make check so it cannot be merged:

 GTESTER check-qtest-x86_64
 qemu-system-x86_64: logical_block_size must be 512 for IDE
 qemu-system-x86_64: Device initialization failed.
 qemu-system-x86_64: Initialization of device ide-cd failed
 Broken pipe
 GTester: last random seed: R02S942fac7e56eff09e8ab7a7f7fecf847e


 This particular message came in with 

 commit d20051856cd2fa8f10fed2d2a0b2751de5f7b20d
 Author: Kevin Wolf kw...@redhat.com
 Date:   Wed Dec 3 13:21:32 2014 +0100

 ide: Check validity of logical block size

 so something like
 diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
 index 353854c..2680275 100644
 --- a/hw/ide/qdev.c
 +++ b/hw/ide/qdev.c
 @@ -163,7 +163,8 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind 
 kind)
  return -1;
  }
  
 -if (dev-conf.logical_block_size != 512) {
 +if (dev-conf.logical_block_size != 512 
 +dev-conf.logical_block_size != 0) {
  error_report(logical_block_size must be 512 for IDE);
  return -1;
  }


 will fix this.
 
 It would probably be better to set the default first and then make sure
 that the final value, no matter whether explicitly specified or default,
 is 512.
 
 Kevin

+1 
Yes, this should minimize the impact. 




Re: [Qemu-devel] [PATCH v6 0/5] Geometry and blocksize detection for backing devices.

2015-02-12 Thread Kevin Wolf
Am 12.02.2015 um 17:42 hat Christian Borntraeger geschrieben:
 Am 12.02.2015 um 16:46 schrieb Stefan Hajnoczi:
  On Mon, Jan 19, 2015 at 03:34:56PM +0100, Ekaterina Tumanova wrote:
  Updates v5 - v6:
 
  Minor Updates according the last review from Stefan Hajnoczi:
  1. Do not change the flow of code, factored out of raw_probe_alignment.
  2. added #ifdef __linux__ in 2 places of raw-posix.c, mentioned by 
  reviewer.
  3. adjusted the comment hdev_probe_geometry according suggestment.
  4. use bdrv_nb_sectors(bs) instead of bs-total_sectors.
  5. do not discard error blk_probe_blocksizes(). now has rc.
  6. put the 512-byte default blocksize value in blkconf_blocksizes.
  7. drop the default parameter from the DEFINE_PROP_BLOCKSIZE() macro.
  
  Unfortunately this series breaks make check so it cannot be merged:
  
  GTESTER check-qtest-x86_64
  qemu-system-x86_64: logical_block_size must be 512 for IDE
  qemu-system-x86_64: Device initialization failed.
  qemu-system-x86_64: Initialization of device ide-cd failed
  Broken pipe
  GTester: last random seed: R02S942fac7e56eff09e8ab7a7f7fecf847e
  
 
 This particular message came in with 
 
 commit d20051856cd2fa8f10fed2d2a0b2751de5f7b20d
 Author: Kevin Wolf kw...@redhat.com
 Date:   Wed Dec 3 13:21:32 2014 +0100
 
 ide: Check validity of logical block size
 
 so something like
 diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
 index 353854c..2680275 100644
 --- a/hw/ide/qdev.c
 +++ b/hw/ide/qdev.c
 @@ -163,7 +163,8 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind 
 kind)
  return -1;
  }
  
 -if (dev-conf.logical_block_size != 512) {
 +if (dev-conf.logical_block_size != 512 
 +dev-conf.logical_block_size != 0) {
  error_report(logical_block_size must be 512 for IDE);
  return -1;
  }
 
 
 will fix this.

It would probably be better to set the default first and then make sure
that the final value, no matter whether explicitly specified or default,
is 512.

Kevin



Re: [Qemu-devel] [PATCH v6 0/5] Geometry and blocksize detection for backing devices.

2015-02-12 Thread Stefan Hajnoczi
On Mon, Jan 19, 2015 at 03:34:56PM +0100, Ekaterina Tumanova wrote:
 Updates v5 - v6:
 
 Minor Updates according the last review from Stefan Hajnoczi:
 1. Do not change the flow of code, factored out of raw_probe_alignment.
 2. added #ifdef __linux__ in 2 places of raw-posix.c, mentioned by reviewer.
 3. adjusted the comment hdev_probe_geometry according suggestment.
 4. use bdrv_nb_sectors(bs) instead of bs-total_sectors.
 5. do not discard error blk_probe_blocksizes(). now has rc.
 6. put the 512-byte default blocksize value in blkconf_blocksizes.
 7. drop the default parameter from the DEFINE_PROP_BLOCKSIZE() macro.

Unfortunately this series breaks make check so it cannot be merged:

GTESTER check-qtest-x86_64
qemu-system-x86_64: logical_block_size must be 512 for IDE
qemu-system-x86_64: Device initialization failed.
qemu-system-x86_64: Initialization of device ide-cd failed
Broken pipe
GTester: last random seed: R02S942fac7e56eff09e8ab7a7f7fecf847e


pgpj8UJbTTEol.pgp
Description: PGP signature


Re: [Qemu-devel] [PATCH v6 0/5] Geometry and blocksize detection for backing devices.

2015-02-12 Thread Christian Borntraeger
Am 12.02.2015 um 16:46 schrieb Stefan Hajnoczi:
 On Mon, Jan 19, 2015 at 03:34:56PM +0100, Ekaterina Tumanova wrote:
 Updates v5 - v6:

 Minor Updates according the last review from Stefan Hajnoczi:
 1. Do not change the flow of code, factored out of raw_probe_alignment.
 2. added #ifdef __linux__ in 2 places of raw-posix.c, mentioned by reviewer.
 3. adjusted the comment hdev_probe_geometry according suggestment.
 4. use bdrv_nb_sectors(bs) instead of bs-total_sectors.
 5. do not discard error blk_probe_blocksizes(). now has rc.
 6. put the 512-byte default blocksize value in blkconf_blocksizes.
 7. drop the default parameter from the DEFINE_PROP_BLOCKSIZE() macro.
 
 Unfortunately this series breaks make check so it cannot be merged:
 
 GTESTER check-qtest-x86_64
 qemu-system-x86_64: logical_block_size must be 512 for IDE
 qemu-system-x86_64: Device initialization failed.
 qemu-system-x86_64: Initialization of device ide-cd failed
 Broken pipe
 GTester: last random seed: R02S942fac7e56eff09e8ab7a7f7fecf847e
 

This particular message came in with 

commit d20051856cd2fa8f10fed2d2a0b2751de5f7b20d
Author: Kevin Wolf kw...@redhat.com
Date:   Wed Dec 3 13:21:32 2014 +0100

ide: Check validity of logical block size

so something like
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index 353854c..2680275 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -163,7 +163,8 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind)
 return -1;
 }
 
-if (dev-conf.logical_block_size != 512) {
+if (dev-conf.logical_block_size != 512 
+dev-conf.logical_block_size != 0) {
 error_report(logical_block_size must be 512 for IDE);
 return -1;
 }


will fix this.

Now we have 
block.c:582: bdrv_probe_blocksizes: Assertion `drv != ((void *)0)' failed

so
we need something like this on top - I guess.

diff --git a/block.c b/block.c
index dbc2519..8bbcc6d 100644
--- a/block.c
+++ b/block.c
@@ -579,8 +579,7 @@ int bdrv_probe_blocksizes(BlockDriverState *bs, BlockSizes 
*bsz)
 {
 BlockDriver *drv = bs-drv;
 
-assert(drv != NULL);
-if (drv-bdrv_probe_blocksizes) {
+if (drv  drv-bdrv_probe_blocksizes) {
 return drv-bdrv_probe_blocksizes(bs, bsz);
 }
 
@@ -597,8 +596,7 @@ int bdrv_probe_geometry(BlockDriverState *bs, HDGeometry 
*geo)
 {
 BlockDriver *drv = bs-drv;
 
-assert(drv != NULL);
-if (drv-bdrv_probe_geometry) {
+if (drv  drv-bdrv_probe_geometry) {
 return drv-bdrv_probe_geometry(bs, geo);
 }
 

Kate, I think its time for a v7 :-(




Re: [Qemu-devel] [PATCH v6 0/5] Geometry and blocksize detection for backing devices.

2015-02-12 Thread Christian Borntraeger
Am 12.02.2015 um 17:42 schrieb Christian Borntraeger:
 Am 12.02.2015 um 16:46 schrieb Stefan Hajnoczi:
 On Mon, Jan 19, 2015 at 03:34:56PM +0100, Ekaterina Tumanova wrote:
 Updates v5 - v6:

 Minor Updates according the last review from Stefan Hajnoczi:
 1. Do not change the flow of code, factored out of raw_probe_alignment.
 2. added #ifdef __linux__ in 2 places of raw-posix.c, mentioned by reviewer.
 3. adjusted the comment hdev_probe_geometry according suggestment.
 4. use bdrv_nb_sectors(bs) instead of bs-total_sectors.
 5. do not discard error blk_probe_blocksizes(). now has rc.
 6. put the 512-byte default blocksize value in blkconf_blocksizes.
 7. drop the default parameter from the DEFINE_PROP_BLOCKSIZE() macro.

 Unfortunately this series breaks make check so it cannot be merged:

 GTESTER check-qtest-x86_64
 qemu-system-x86_64: logical_block_size must be 512 for IDE
 qemu-system-x86_64: Device initialization failed.
 qemu-system-x86_64: Initialization of device ide-cd failed
 Broken pipe
 GTester: last random seed: R02S942fac7e56eff09e8ab7a7f7fecf847e

 
 This particular message came in with 
 
 commit d20051856cd2fa8f10fed2d2a0b2751de5f7b20d
 Author: Kevin Wolf kw...@redhat.com
 Date:   Wed Dec 3 13:21:32 2014 +0100
 
 ide: Check validity of logical block size
 
 so something like
 diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
 index 353854c..2680275 100644
 --- a/hw/ide/qdev.c
 +++ b/hw/ide/qdev.c
 @@ -163,7 +163,8 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind 
 kind)
  return -1;
  }
  
 -if (dev-conf.logical_block_size != 512) {
 +if (dev-conf.logical_block_size != 512 
 +dev-conf.logical_block_size != 0) {
  error_report(logical_block_size must be 512 for IDE);
  return -1;
  }
 
 
 will fix this.
 
 Now we have 
 block.c:582: bdrv_probe_blocksizes: Assertion `drv != ((void *)0)' failed
 
 so
 we need something like this on top - I guess.
 
 diff --git a/block.c b/block.c
 index dbc2519..8bbcc6d 100644
 --- a/block.c
 +++ b/block.c
 @@ -579,8 +579,7 @@ int bdrv_probe_blocksizes(BlockDriverState *bs, 
 BlockSizes *bsz)
  {
  BlockDriver *drv = bs-drv;
  
 -assert(drv != NULL);
 -if (drv-bdrv_probe_blocksizes) {
 +if (drv  drv-bdrv_probe_blocksizes) {
  return drv-bdrv_probe_blocksizes(bs, bsz);
  }
  
 @@ -597,8 +596,7 @@ int bdrv_probe_geometry(BlockDriverState *bs, HDGeometry 
 *geo)
  {
  BlockDriver *drv = bs-drv;
  
 -assert(drv != NULL);
 -if (drv-bdrv_probe_geometry) {
 +if (drv  drv-bdrv_probe_geometry) {
  return drv-bdrv_probe_geometry(bs, geo);
  }
  
 
 Kate, I think its time for a v7 :-(

Of course, please double check my quick hacks. I still see some broken pipe 
messages, so I must have missed something.




Re: [Qemu-devel] [PATCH v6 0/5] Geometry and blocksize detection for backing devices.

2015-02-05 Thread Stefan Hajnoczi
On Mon, Jan 19, 2015 at 03:34:56PM +0100, Ekaterina Tumanova wrote:
 Updates v5 - v6:
 
 Minor Updates according the last review from Stefan Hajnoczi:
 1. Do not change the flow of code, factored out of raw_probe_alignment.
 2. added #ifdef __linux__ in 2 places of raw-posix.c, mentioned by reviewer.
 3. adjusted the comment hdev_probe_geometry according suggestment.
 4. use bdrv_nb_sectors(bs) instead of bs-total_sectors.
 5. do not discard error blk_probe_blocksizes(). now has rc.
 6. put the 512-byte default blocksize value in blkconf_blocksizes.
 7. drop the default parameter from the DEFINE_PROP_BLOCKSIZE() macro.
 
 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_xx 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: Factor block size detection out of raw_probe_alignment()
   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|  36 ++
  block/block-backend.c  |  10 +++
  block/raw-posix.c  | 154 
 -
  block/raw_bsd.c|  12 
  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/block/block.h  |  13 
  include/block/block_int.h  |  15 
  include/hw/block/block.h   |   5 +-
  include/hw/qdev-properties.h   |   4 +-
  include/sysemu/block-backend.h |   2 +
  17 files changed, 267 insertions(+), 22 deletions(-)
 
 -- 
 2.1.4
 

Reviewed-by: Stefan Hajnoczi stefa...@redhat.com


pgpT1yRBFUrcz.pgp
Description: PGP signature


Re: [Qemu-devel] [PATCH v6 0/5] Geometry and blocksize detection for backing devices.

2015-02-04 Thread Ekaterina Tumanova

On 01/19/2015 05:34 PM, Ekaterina Tumanova wrote:

Updates v5 - v6:

Minor Updates according the last review from Stefan Hajnoczi:
1. Do not change the flow of code, factored out of raw_probe_alignment.
2. added #ifdef __linux__ in 2 places of raw-posix.c, mentioned by reviewer.
3. adjusted the comment hdev_probe_geometry according suggestment.
4. use bdrv_nb_sectors(bs) instead of bs-total_sectors.
5. do not discard error blk_probe_blocksizes(). now has rc.
6. put the 512-byte default blocksize value in blkconf_blocksizes.
7. drop the default parameter from the DEFINE_PROP_BLOCKSIZE() macro.

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_xx 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: Factor block size detection out of raw_probe_alignment()
   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|  36 ++
  block/block-backend.c  |  10 +++
  block/raw-posix.c  | 154 -
  block/raw_bsd.c|  12 
  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/block/block.h  |  13 
  include/block/block_int.h  |  15 
  include/hw/block/block.h   |   5 +-
  include/hw/qdev-properties.h   |   4 +-
  include/sysemu/block-backend.h |   2 +
  17 files changed, 267 insertions(+), 22 deletions(-)



ping




Re: [Qemu-devel] [PATCH v6 0/5] Geometry and blocksize detection for backing devices.

2015-01-22 Thread Christian Borntraeger
Am 19.01.2015 um 15:34 schrieb Ekaterina Tumanova:
 Updates v5 - v6:
 
 Minor Updates according the last review from Stefan Hajnoczi:
 1. Do not change the flow of code, factored out of raw_probe_alignment.
 2. added #ifdef __linux__ in 2 places of raw-posix.c, mentioned by reviewer.
 3. adjusted the comment hdev_probe_geometry according suggestment.
 4. use bdrv_nb_sectors(bs) instead of bs-total_sectors.
 5. do not discard error blk_probe_blocksizes(). now has rc.
 6. put the 512-byte default blocksize value in blkconf_blocksizes.
 7. drop the default parameter from the DEFINE_PROP_BLOCKSIZE() macro.
 
 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_xx 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: Factor block size detection out of raw_probe_alignment()
   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|  36 ++
  block/block-backend.c  |  10 +++
  block/raw-posix.c  | 154 
 -
  block/raw_bsd.c|  12 
  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/block/block.h  |  13 
  include/block/block_int.h  |  15 
  include/hw/block/block.h   |   5 +-
  include/hw/qdev-properties.h   |   4 +-
  include/sysemu/block-backend.h |   2 +
  17 files changed, 267 insertions(+), 22 deletions(-)
 

Just gave version 6 a try. My dasd is recognizes as it should be.
So
Tested-by: Christian Borntraeger borntrae...@de.ibm.com




[Qemu-devel] [PATCH v6 0/5] Geometry and blocksize detection for backing devices.

2015-01-19 Thread Ekaterina Tumanova
Updates v5 - v6:

Minor Updates according the last review from Stefan Hajnoczi:
1. Do not change the flow of code, factored out of raw_probe_alignment.
2. added #ifdef __linux__ in 2 places of raw-posix.c, mentioned by reviewer.
3. adjusted the comment hdev_probe_geometry according suggestment.
4. use bdrv_nb_sectors(bs) instead of bs-total_sectors.
5. do not discard error blk_probe_blocksizes(). now has rc.
6. put the 512-byte default blocksize value in blkconf_blocksizes.
7. drop the default parameter from the DEFINE_PROP_BLOCKSIZE() macro.

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_xx 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: Factor block size detection out of raw_probe_alignment()
  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|  36 ++
 block/block-backend.c  |  10 +++
 block/raw-posix.c  | 154 -
 block/raw_bsd.c|  12 
 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/block/block.h  |  13 
 include/block/block_int.h  |  15 
 include/hw/block/block.h   |   5 +-
 include/hw/qdev-properties.h   |   4 +-
 include/sysemu/block-backend.h |   2 +
 17 files changed, 267 insertions(+), 22 deletions(-)

-- 
2.1.4