qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v2 00/45] Block layer cleanup & fixes


From: Markus Armbruster
Subject: [Qemu-devel] [PATCH v2 00/45] Block layer cleanup & fixes
Date: Wed, 3 Aug 2011 15:07:39 +0200

This patch series looks bigger than it is.  All the patches are small
and hopefully easy to review.

Objectives:

* Push BlockDriverState members locked, tray_open, media_changed into
  device models, where they belong.

* BlockDriverState member removable is a confusing mess, replace it.

* Improve eject -f.

Also clean up minor messes as they get in the way.

It is based on Kevin's block branch f08df41b.

Part I: Preliminaries
PATCH 01-03: Work on block layer interface for device models

Part II: Move tray state to device models
PATCH 04-10 IDE tray open/closed
PATCH 11-12 SCSI tray open/closed
PATCH 13-14 block layer kill tray_open
PATCH 15-16 IDE & SCSI tray lock
PATCH 17-19 block layer kill locked
PATCH 20-24 IDE & SCSI tray bug fixes
PATCH 25-27 IDE & SCSI migrate tray state
PATCH 28-30 block layer & fdc media_changed

Part III: Replace removable
PATCH 31-34 clean up inappopriate uses of removable
PATCH 35-36 replace remaining users

Part IV: Miscellaneous
PATCH 37    cover tray open/closed in info block
PATCH 38-43 Reduce unclean use of block_int.h
PATCH 44-45 Improve eject -f

Naturally, I want all parts applied.  But I did my best to make
applying only a prefix workable, too.

Review invited from:

* Kevin, Christoph and Amit reviewed v1.

* Hannes commented on the SCSI stuff in v1.

* Luiz, the following patches affect QMP's query-block: PATCH 35
  `block: Clean up remaining users of "removable"' and PATCH 38
  `block: Show whether the guest ejected the medium in info block'.

* Juan, please review PATCH 26 `ide/atapi: Preserve tray state on
  migration', PATCH 27 `scsi-disk: Preserve tray state on migration',
  and PATCH 32 `savevm: Include writable devices with removable
  media'.

* Andrzej commented to v1 of PATCH 34 `spitz tosa: Simplify "drive is
  suitable for microdrive" test'.  It is unchanged.

* Stefano, you reviewed v1 of PATCH 35 (affects "-drive if=xen").
  Please have a look at new PATCH 33 `xen: Clean up
  pci_piix3_xen_ide_unplug()'s test for "not a CD"'.

Testing

* Both master and the block branch are broken for me by Avi's memory
  API work (Avi reproduced, and claims to have a fix), so for testing
  I had to rebase the block branch on an older master cde1a700 plus my
  dependencies: some Xen work e3745602..679f4f8b, and some nand work
  64de0e46..63efb1d9.

* Linux boots, both from HD and CD.

* For both IDE and SCSI:

  - info block reports tray state correctly

  - Guest locking the tray stops eject (without -f) and change

  - eject -f; change works even while tray is locked by guest

  - Physical tray state tracks the virtual one (file=/dev/sr0)

  - Reading /dev/sr0 with tray open behaves as before: IDE closes the
    tray and reads (matches bare metal), SCSI reports no medium

  - Tray state is migrated correctly (tested with savevm/loadvm)

* Guest still notices CD media change (IDE only, SCSI doesn't work
  before or after my patches because GESN isn't implemented)

* Migrating ide-cd to older version works when tray is closed and
  unlocked, else fails (tested with savevm/loadvm)

* Migrating scsi-cd to older version fails

* Linux detects fdc media change (from monitor)

* savevm and loadvm snapshot read/write floppy

* spitz and tosa initialize their microdrive as before (PATCH 34;
  tested with -S -M {spitz,tosa}, didn't actually try to boot)

Not tested:

* BlockDriver "host_floppy"

  Lack the hardware.  Like pretty much everybody not running a
  computer museum.  

  Is keeping BlockDriver "host_floppy" around still worth our while?

  If the answer is no, I'm happy to respin with PATCH 28-30 replaced
  by a single patch to remove it, and simplify block.c and hw/fdc.c.


v2:

* Rebased to block branch; non-trivial conflicts:
  - Old PATCH 01-02,06-09 already there, drop
  - `block: Attach non-qdev devices as well':
    - cover new pci_piix3_xen_ide_unplug()
    - hw/nand has been qdefivied, drop hunk
    - onenand_init() changed, rewrite hunk
  - pci_piix3_xen_ide_unplug() needs new PATCH 33.

* Drop old PATCH 18 `scsi-disk: Reject CD-specific SCSI commands to
  disks' because Hannes wants to do it differently, and it's not
  essential to this series.

* Christoph's advice:
  - Rework `ide: Update command code definitions as per ACS-2'
  - Add comment to `ide: Fix ATA command READ to set ATAPI signature
    for CD-ROM'
  - Squash `ide/atapi: Track tray open/close state' and `ide/atapi:
    Switch from BlockDriverState's tray_open to own'
  - Squash `ide/atapi: Track tray locked state' and `ide/atapi: Switch
    from BlockDriverState's locked to own tray_locked'
  - Squash `scsi-disk: Track tray locked state' and `scsi-disk: Switch
    from BlockDriverState's locked to own tray_locked'
  - Drop `block: Move BlockDriverAIOCB & friends from block_int.h to
    block.h'

* Luiz's advice:
  - Change query-block to always include "ejected" for removable
    devices.  Requires moving `block: Show whether the guest ejected
    the medium in info block', which causes a bunch of conflicts.

* A few cosmetic improvements


Markus Armbruster (45):
  block: Attach non-qdev devices as well
  block: Generalize change_cb() to BlockDevOps
  block: Split change_cb() into change_media_cb(), resize_cb()
  ide: Update command code definitions as per ACS-2 Table B.2
  ide: Clean up case label indentation in ide_exec_cmd()
  ide: Fix ATA command READ to set ATAPI signature for CD-ROM
  ide: Use a table to declare which drive kinds accept each command
  ide: Reject ATA commands specific to drive kinds
  ide/atapi: Clean up misleading name in cmd_start_stop_unit()
  ide/atapi: Track tray open/close state
  scsi-disk: Factor out scsi_disk_emulate_start_stop()
  scsi-disk: Track tray open/close state
  block: Revert entanglement of bdrv_is_inserted() with tray status
  block: Drop tray status tracking, no longer used
  ide/atapi: Track tray locked state
  scsi-disk: Track tray locked state
  block: Leave enforcing tray lock to device models
  block: Drop medium lock tracking, ask device models instead
  block: Rename bdrv_set_locked() to bdrv_lock_medium()
  ide: Provide IDEDeviceInfo method exit()
  ide/atapi: Don't fail eject when tray is already open
  ide/atapi: Avoid physical/virtual tray state mismatch
  scsi-disk: Fix START_STOP to fail when it can't eject
  scsi-disk: Avoid physical/virtual tray state mismatch
  ide: Give vmstate structs internal linkage where possible
  ide/atapi: Preserve tray state on migration
  scsi-disk: Preserve tray state on migration
  block/raw: Fix to forward method bdrv_media_changed()
  block: Leave tracking media change to device models
  fdc: Make media change detection more robust
  block: Clean up bdrv_flush_all()
  savevm: Include writable devices with removable media
  xen: Clean up pci_piix3_xen_ide_unplug()'s test for "not a CD"
  spitz tosa: Simplify "drive is suitable for microdrive" test
  block: Clean up remaining users of "removable"
  block: Drop BlockDriverState member removable
  block: Show whether the guest ejected the medium in info block
  block: Move BlockConf & friends from block_int.h to block.h
  hw: Trim superfluous #include "block_int.h"
  block: Declare qemu_blockalign() in block.h, not block_int.h
  block: New bdrv_set_buffer_alignment()
  block: Reset buffer alignment on detach
  nbd: Clean up use of block_int.h
  block: New change_media_cb() parameter load
  ide/atapi scsi-disk: Make monitor eject -f, then change work

 block.c              |  195 +++++++++++++++++++++++++++-----------------------
 block.h              |   90 ++++++++++++++++++++---
 block/nbd.c          |    1 +
 block/raw-posix.c    |    8 +-
 block/raw.c          |   13 +++-
 block_int.h          |   54 ++-------------
 blockdev.c           |   15 ++---
 hw/fdc.c             |   48 ++++++-------
 hw/ide/atapi.c       |   58 +++++++--------
 hw/ide/cmd646.c      |    1 -
 hw/ide/core.c        |  196 ++++++++++++++++++++++++++++++++++++++------------
 hw/ide/ich.c         |    1 -
 hw/ide/internal.h    |  175 ++++++++++++++++++++++++---------------------
 hw/ide/isa.c         |    1 -
 hw/ide/macio.c       |    1 -
 hw/ide/microdrive.c  |    1 -
 hw/ide/mmio.c        |    1 -
 hw/ide/pci.c         |    1 -
 hw/ide/piix.c        |    7 +-
 hw/ide/qdev.c        |   30 ++++++++
 hw/ide/via.c         |    1 -
 hw/lsi53c895a.c      |    1 -
 hw/onenand.c         |    4 +-
 hw/pflash_cfi01.c    |    1 +
 hw/pflash_cfi02.c    |    1 +
 hw/qdev-properties.c |    6 +-
 hw/scsi-bus.c        |   10 +++
 hw/scsi-disk.c       |  111 ++++++++++++++++++++++++++---
 hw/scsi-generic.c    |    1 -
 hw/scsi.h            |    5 +-
 hw/sd.c              |   14 ++--
 hw/spitz.c           |   10 +--
 hw/tosa.c            |   10 +--
 hw/usb-msd.c         |    2 +-
 hw/virtio-blk.c      |   15 ++--
 hw/virtio.h          |    2 +-
 hw/xen_disk.c        |    1 +
 nbd.c                |    1 +
 nbd.h                |    2 -
 qmp-commands.hx      |    2 +
 savevm.c             |    4 +-
 trace-events         |    2 +-
 42 files changed, 690 insertions(+), 413 deletions(-)

-- 
1.7.6




reply via email to

[Prev in Thread] Current Thread [Next in Thread]