qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH v3 00/23] Split BlockBackend off BDS with an axe


From: Markus Armbruster
Subject: [Qemu-devel] [PATCH v3 00/23] Split BlockBackend off BDS with an axe
Date: Tue, 16 Sep 2014 20:12:05 +0200

My last attempt got bogged down because I tried to do a reasonably
complete job, and the complexity proved more than I could handle with
the limited amount of uninterrupted time available.  This time, I'm
cutting BlockBackend off with an axe, leaving most of the work for
later.

Done in this series already:

* Introduce a BlockBackend type, and lift up BlockDriverState's
  device_name, device_list, dev, dev_ops, dev_opaque.  Much more
  remains to be lifted.

* Make BlockBackend own the DriveInfo.

* Wean hw/ off BlockDriverState, with two small exceptions.

* Fix blockdev-add not to create a bogus IDE drive (0,0).

* Take a few baby steps towards use of BlockBackend in monitor command
  code where appropriate.

Coming soon, hopefully:

* QMP command blockdev-del

* blockdev-add accepts node-name without id at top level

* Lift up more stuff

* More BlockBackend use in monitor command code

Depends on my
[PATCH 0/4] Miscellaneous block fixes

I know the diffstat looks intimidating.  I tried very hard to split
the patches so that the bigger ones do just one simple thing, and
mostly mechanically.

v3:
* Rebased
* A few comments here and there [Benoît]
* PATCH 02-04: Drop flawed attempt to avoid leaking BB on drive_del
  while a device model is connected [Flaw pointed out by Max]
* PATCH 02: Check blk_by_name()'s precondition with assert() [Benoît]
* PATCH 03: blk_new_with_bs() in qemu-nbd.c [Max, Benoît]
* PATCH 10: Cover hw/arm/virt.c (semantic conflict)
* PATCH 14: Plenty of conflicts with Benoît's "Extract block
  accounting statistic code in it's own module" series

v2:
* General
  - Improved function comments [Kevin, Benoît]
  - Avoiding temporary badness around drive_del affects several
    patches up to PATCH 14/23, but by then the solution is basically
    v1's again, plus a simple bug fix.
* [PATCH 01/23] block: Split bdrv_new_root() off bdrv_new()
  - Call it bdrv_new_root() instead of bdrv_new_named(), because it'll
    lose its name parameter in PATCH 08.  In v1, it gets removed there.
  - Drop a condition that cannot be false due to prior assertion
* [PATCH 02/23] block: New BlockBackend
  - Commit message amended to explain when BlockBackends get created
    and destroyed [Kevin]
  - License reluctantly changed to LGPL2.1+ [Kevin]
  - Plug leak on error in blk_new() [Kevin]
  - g_assert() is silly, stick to plain assert() [Kevin]
  - Fix double-free when do_drive_del() leaves BDS destruction to
    blockdev_auto_del(), and user adds a BB with the same name in
    between [Kevin]
    Note: bug goes away later in v1
  - Plug a bunch of leaks on error in qemu-img.c [Kevin, Benoît]
    Note: bugs goes away later in v1
  - Update for "[PATCH 3/4] qemu-nbd: Destroy the BlockDriverState
    properly"
* [PATCH 03/23] block: Connect BlockBackend to BlockDriverState
  - Keep the double-free just mentioned fixed; commit message amended
    to explain the drive_del complications
    Basically move v1's solution from "[PATCH 14/23] hw: Convert from
    BlockDriverState to BlockBackend, mostly" here, plus a fix for
    invalid queue removal in blk_delete()
  - Cleanup extracted and posted separately as "[PATCH 1/4] blockdev:
    Disentangle BlockDriverState and DriveInfo creation" [Kevin]
  - Inline blk_attach_bs(), blk_detach_bs() into only callers
  - Rebase on PATCH 02's qemu-img.c leak fixes, basically reverting
    its error path complications
  - Update for "[PATCH 3/4] qemu-nbd: Destroy the BlockDriverState
    properly"
* [PATCH 04/23] block: Connect BlockBackend and DriveInfo
  - Bug fix extracted and posted separately as "[PATCH 2/4] block:
    Keep DriveInfo alive until BlockDriverState dies" [Kevin]
    Unlike v1, it takes care to preserve the guard against
    qemu_opts_del(NULL)
    Could only happen when drive_del'ing something created with
    blockdev-add, which is impossible since "[PATCH] blockdev: Refuse
    to drive_del something added with blockdev-add", but not obviously
    so
    Becomes obvious in PATCH 18, which duly drops the guard
  - Plug leak on error in drive_new() [Kevin]
* [PATCH 05/23] block: Code motion to get rid of stubs/blockdev.c
  - New; to separate some of the cleanup of the mess made in said
    extracted bug fix from the previous patch, to keep it more readable
* [PATCH 06/23] block: Make BlockBackend own its BlockDriverState
  - Update for "[PATCH 3/4] qemu-nbd: Destroy the BlockDriverState
    properly"
* [PATCH 07/23] block: Eliminate bdrv_states, use block_next() instead
  - Drop; it can break things when a root BDS outlives its BB, because
    something else is holding a reference to the BDS when the BB dies
* [PATCH 07/23] block: Eliminate bdrv_iterate(), use bdrv_next()
  - Fix accidental removal of a line [Benoît]
* [PATCH 08/23] block: Eliminate BlockDriverState member device_name[]
  - Commit message: typo fixed [Eric], clarified
  - Update for [PATCH 4/4] block: Improve message for device name
    clashing with node name
  - Ripple effects from drop of PATCH 07
  - Neater implementation of bdrv_get_device_name() [Benoît]
* [PATCH 09/23] block: Merge BlockBackend and BlockDriverState name
  spaces
  - Update for [PATCH 4/4] block: Improve message for device name
    clashing with node name
* [PATCH 10/23] block: Eliminate DriveInfo member bdrv, use
  - Commit message amended to explain the repetitive changes [Eric]
* [PATCH 11/23] block: Rename BlockDriverAIOCB* to BlockAIOCB*
* [PATCH 12/23] virtio-blk: Drop redundant VirtIOBlock member conf
* [PATCH 13/23] virtio-blk: Rename VirtIOBlkConf variables to conf
  - All three unchanged
* [PATCH 14/23] hw: Convert from BlockDriverState to BlockBackend,
  mostly
  - Less the stuff now in PATCH 03; see above
* [PATCH 15/23] ide: Complete conversion from BlockDriverState to
  BlockBackend
* [PATCH 16/23] pc87312: Drop unused members of PC87312State
  - Both unchanged
* [PATCH 17/23] blockdev: Drop superfluous DriveInfo member id
  - Trivial context change due to qemu_opts_del(NULL) guard mentioned
    above
* [PATCH 18/23] blockdev: Fix blockdev-add not to create IDE drive
  (0,0)
  - Since blockdev-add no longer creates a DriveInfo, the guard just
    mentioned is now obviously unnecessary; drop it
* [PATCH 19/23] blockdev: Drop DriveInfo member enable_auto_del
  - Update for [PATCH] blockdev: Refuse to drive_del something added
    with blockdev-add
* [PATCH 20/23] block/qapi: Convert qmp_query_block() to BlockBackend
* [PATCH 21/23] blockdev: Convert qmp_eject(), qmp_change_blockdev()
  to BlockBackend
  - Both unchanged
* [PATCH 22/23] block: Lift device model API into BlockBackend
  - Only comments and context differences
* [PATCH 23/23] block: Make device model's references to BlockBackend
  - Unchanged

Markus Armbruster (23):
  block: Split bdrv_new_root() off bdrv_new()
  block: New BlockBackend
  block: Connect BlockBackend to BlockDriverState
  block: Connect BlockBackend and DriveInfo
  block: Code motion to get rid of stubs/blockdev.c
  block: Make BlockBackend own its BlockDriverState
  block: Eliminate bdrv_iterate(), use bdrv_next()
  block: Eliminate BlockDriverState member device_name[]
  block: Merge BlockBackend and BlockDriverState name spaces
  block: Eliminate DriveInfo member bdrv, use blk_by_legacy_dinfo()
  block: Rename BlockDriverAIOCB* to BlockAIOCB*
  virtio-blk: Drop redundant VirtIOBlock member conf
  virtio-blk: Rename VirtIOBlkConf variables to conf
  hw: Convert from BlockDriverState to BlockBackend, mostly
  ide: Complete conversion from BlockDriverState to BlockBackend
  pc87312: Drop unused members of PC87312State
  blockdev: Drop superfluous DriveInfo member id
  blockdev: Fix blockdev-add not to create IDE drive (0,0)
  blockdev: Drop DriveInfo member enable_auto_del
  block/qapi: Convert qmp_query_block() to BlockBackend
  blockdev: Convert qmp_eject(), qmp_change_blockdev() to BlockBackend
  block: Lift device model API into BlockBackend
  block: Make device model's references to BlockBackend strong

 block-migration.c                        |  44 +--
 block.c                                  | 379 +++++++------------
 block/Makefile.objs                      |   2 +-
 block/archipelago.c                      |  30 +-
 block/backup.c                           |   2 +-
 block/blkdebug.c                         |  22 +-
 block/blkverify.c                        |  20 +-
 block/block-backend.c                    | 622 +++++++++++++++++++++++++++++++
 block/commit.c                           |   2 +-
 block/cow.c                              |   2 +-
 block/curl.c                             |   8 +-
 block/iscsi.c                            |  10 +-
 block/linux-aio.c                        |   8 +-
 block/mirror.c                           |   9 +-
 block/qapi.c                             |  27 +-
 block/qcow.c                             |   4 +-
 block/qcow2.c                            |   4 +-
 block/qed-gencb.c                        |   4 +-
 block/qed-table.c                        |  10 +-
 block/qed.c                              |  48 +--
 block/qed.h                              |  12 +-
 block/quorum.c                           |  42 +--
 block/raw-aio.h                          |   8 +-
 block/raw-posix.c                        |  32 +-
 block/raw-win32.c                        |  16 +-
 block/raw_bsd.c                          |   8 +-
 block/rbd.c                              |  58 +--
 block/sheepdog.c                         |   4 +-
 block/stream.c                           |   2 +-
 block/vdi.c                              |   2 +-
 block/vhdx.c                             |   2 +-
 block/vmdk.c                             |   4 +-
 block/vpc.c                              |   2 +-
 block/vvfat.c                            |   4 +-
 block/win32-aio.c                        |   8 +-
 blockdev.c                               | 193 ++++------
 blockjob.c                               |   7 +-
 dma-helpers.c                            |  69 ++--
 hw/arm/collie.c                          |  10 +-
 hw/arm/gumstix.c                         |   6 +-
 hw/arm/highbank.c                        |   2 +-
 hw/arm/mainstone.c                       |   8 +-
 hw/arm/musicpal.c                        |  13 +-
 hw/arm/nseries.c                         |   7 +-
 hw/arm/omap1.c                           |   4 +-
 hw/arm/omap2.c                           |   4 +-
 hw/arm/omap_sx1.c                        |  10 +-
 hw/arm/pxa2xx.c                          |   7 +-
 hw/arm/realview.c                        |   2 +-
 hw/arm/spitz.c                           |   6 +-
 hw/arm/tosa.c                            |   3 +-
 hw/arm/versatilepb.c                     |   5 +-
 hw/arm/vexpress.c                        |   5 +-
 hw/arm/virt.c                            |   4 +-
 hw/arm/xilinx_zynq.c                     |   5 +-
 hw/arm/z2.c                              |   8 +-
 hw/block/block.c                         |  23 +-
 hw/block/dataplane/virtio-blk.c          |  35 +-
 hw/block/dataplane/virtio-blk.h          |   2 +-
 hw/block/fdc.c                           |  74 ++--
 hw/block/hd-geometry.c                   |  24 +-
 hw/block/m25p80.c                        |  31 +-
 hw/block/nand.c                          |  50 +--
 hw/block/nvme.c                          |  19 +-
 hw/block/nvme.h                          |   2 +-
 hw/block/onenand.c                       |  67 ++--
 hw/block/pflash_cfi01.c                  |  24 +-
 hw/block/pflash_cfi02.c                  |  24 +-
 hw/block/virtio-blk.c                    | 149 ++++----
 hw/block/xen_disk.c                      |  86 +++--
 hw/core/qdev-properties-system.c         |  26 +-
 hw/core/qdev-properties.c                |   2 +-
 hw/cris/axis_dev88.c                     |   4 +-
 hw/display/tc6393xb.c                    |   4 +-
 hw/i386/pc.c                             |   2 +-
 hw/i386/pc_piix.c                        |   2 +-
 hw/i386/pc_sysfw.c                       |  10 +-
 hw/i386/xen/xen_platform.c               |   5 +-
 hw/ide/ahci.c                            |  33 +-
 hw/ide/ahci.h                            |   2 +-
 hw/ide/atapi.c                           |  33 +-
 hw/ide/cmd646.c                          |   2 +-
 hw/ide/core.c                            | 202 +++++-----
 hw/ide/ich.c                             |   2 +-
 hw/ide/internal.h                        |  16 +-
 hw/ide/isa.c                             |   2 +-
 hw/ide/macio.c                           |  52 +--
 hw/ide/microdrive.c                      |   4 +-
 hw/ide/mmio.c                            |   2 +-
 hw/ide/pci.c                             |   6 +-
 hw/ide/pci.h                             |   2 +-
 hw/ide/piix.c                            |   9 +-
 hw/ide/qdev.c                            |  13 +-
 hw/ide/via.c                             |   2 +-
 hw/isa/pc87312.c                         |   7 +-
 hw/lm32/lm32_boards.c                    |  14 +-
 hw/lm32/milkymist.c                      |   8 +-
 hw/microblaze/petalogix_ml605_mmu.c      |   6 +-
 hw/microblaze/petalogix_s3adsp1800_mmu.c |   6 +-
 hw/mips/mips_fulong2e.c                  |   2 +-
 hw/mips/mips_jazz.c                      |   2 +-
 hw/mips/mips_malta.c                     |   8 +-
 hw/mips/mips_r4k.c                       |   6 +-
 hw/nvram/spapr_nvram.c                   |  17 +-
 hw/pci/pci-hotplug-old.c                 |  10 +-
 hw/ppc/mac.h                             |   2 +-
 hw/ppc/mac_newworld.c                    |   2 +-
 hw/ppc/mac_oldworld.c                    |   2 +-
 hw/ppc/ppc405_boards.c                   |  27 +-
 hw/ppc/prep.c                            |   2 +-
 hw/ppc/spapr.c                           |   4 +-
 hw/ppc/virtex_ml507.c                    |   6 +-
 hw/s390x/s390-virtio-bus.c               |   2 +-
 hw/s390x/s390-virtio.c                   |   2 +-
 hw/s390x/virtio-ccw.c                    |   2 +-
 hw/scsi/megasas.c                        |  15 +-
 hw/scsi/scsi-bus.c                       |  11 +-
 hw/scsi/scsi-disk.c                      | 188 +++++-----
 hw/scsi/scsi-generic.c                   |  41 +-
 hw/sd/milkymist-memcard.c                |   7 +-
 hw/sd/omap_mmc.c                         |   8 +-
 hw/sd/pl181.c                            |   3 +-
 hw/sd/pxa2xx_mmci.c                      |   4 +-
 hw/sd/sd.c                               |  60 +--
 hw/sd/sdhci.c                            |   3 +-
 hw/sd/ssi-sd.c                           |   3 +-
 hw/sh4/r2d.c                             |   6 +-
 hw/sparc/sun4m.c                         |   2 +-
 hw/sparc64/sun4u.c                       |   2 +-
 hw/tpm/tpm_tis.c                         |   2 +-
 hw/tricore/tricore_testboard.c           |   2 +-
 hw/usb/dev-storage.c                     |  19 +-
 hw/virtio/virtio-pci.c                   |   2 +-
 hw/xen/xen_devconfig.c                   |   1 +
 hw/xenpv/xen_machine_pv.c                |   2 +-
 hw/xtensa/xtfpga.c                       |   5 +-
 include/block/aio.h                      |  12 +-
 include/block/block.h                    |  88 ++---
 include/block/block_int.h                |  44 +--
 include/block/blockjob.h                 |   4 +-
 include/block/qapi.h                     |   3 -
 include/block/thread-pool.h              |   4 +-
 include/hw/arm/omap.h                    |   4 +-
 include/hw/arm/pxa.h                     |   2 +-
 include/hw/block/block.h                 |   6 +-
 include/hw/block/flash.h                 |   6 +-
 include/hw/isa/pc87312.h                 |   3 -
 include/hw/qdev-properties.h             |   8 +-
 include/hw/scsi/scsi.h                   |   6 +-
 include/hw/sd.h                          |   2 +-
 include/hw/virtio/virtio-blk.h           |  10 +-
 include/monitor/monitor.h                |   4 +-
 include/qemu/typedefs.h                  |   2 +
 include/sysemu/block-backend.h           | 141 +++++++
 include/sysemu/blockdev.h                |  13 +-
 include/sysemu/dma.h                     |  26 +-
 monitor.c                                |  38 +-
 qemu-img.c                               | 150 ++++----
 qemu-io.c                                |  15 +-
 qemu-nbd.c                               |   8 +-
 stubs/Makefile.objs                      |   1 -
 stubs/blockdev.c                         |  12 -
 tests/test-thread-pool.c                 |   2 +-
 thread-pool.c                            |   8 +-
 trace-events                             |   8 +-
 165 files changed, 2341 insertions(+), 1698 deletions(-)
 create mode 100644 block/block-backend.c
 create mode 100644 include/sysemu/block-backend.h
 delete mode 100644 stubs/blockdev.c

-- 
1.9.3




reply via email to

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