Skip to content

blockdev: Further BlockBackend work

Max Reitz qemu-devel 4 versions – Applied

Status from this message: Thanks, applied to the block branch.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest17 patches 2 repliesApplied
  2. v314 patches 24 repliesSuperseded
  3. v28 patches 8 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v19 patches0 repliesSuperseded

Changes in v4 from the cover letter

- Tightly tied a BB's name to the monitor reference [Kevin]
- Added two patches from my "blockdev: (Nearly) free clean-up work" series which are required so a BB does not need to have a name when bdrv_open() is invoked for its BDS tree
- Added a missing monitor_remove_blk() to the error path of hmp_drive_add() [Kevin]
- v3 just made blk_backends contain all BBs and then added another list called monitor_block_backends. v4 instead renames blk_backends to monitor_block_backends (because both are supposed to be the same, basically) and then adds a new list containing all BBs. [Markus/Kevin]
- blk_hide_on_behalf_of_hmp_drive_del() does a bit more than what monitor_remove_blk() does; namely, it invokes bdrv_make_anon() on the BDS. We should probably continue to do so.
- Use blk_is_inserted() instead of blk_is_available() for blk_commit_all() [Kevin]

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/17monitor: Use BB list for BB name completionmonitor.c+4 -30 replies
2/17block: Use blk_next() in block-backend.cblock/block-backend.c+6 -60 replies
3/17block: Add blk_commit_all()block/block-backend.c include/sysemu/block-backend.h+6 -00 replies
4/17block: Use blk_{commit, flush}_all() consistentlyblockdev.c cpus.c qemu-char.c+6 -40 replies
5/17qapi: Drop QERR_UNKNOWN_BLOCK_FORMAT_FEATUREblock/qcow.c block/qcow2.c block/qed.c +3 more+18 -450 replies
6/17block: Drop BB name from bad option errorblock.c tests/qemu-iotests/051.out tests/qemu-iotests/051.pc.out+11 -110 replies
7/17blockdev: Rename blk_backendsblock/block-backend.c+11 -90 replies
8/17blockdev: Add list of all BlockBackendsblock/block-backend.c+23 -10 replies
9/17blockdev: Separate BB name managementblock/block-backend.c include/sysemu/block-backend.h+63 -310 replies
10/17blockdev: Split monitor reference from BB creationblock/block-backend.c block/parallels.c block/qcow.c +15 more+68 -760 replies
11/17blockdev: Remove blk_hide_on_behalf_of_hmp_drive_del()block/block-backend.c blockdev.c include/sysemu/block-backend.h+6 -240 replies
12/17block: Move some bdrv_*_all() functions to BBblock.c block/block-backend.c block/io.c +3 more+41 -510 replies
13/17block: Add bdrv_next_monitor_owned()blockdev.c include/block/block.h stubs/Makefile.objs +1 more+17 -00 replies
14/17block: Add blk_next_root_bs()block/block-backend.c include/sysemu/block-backend.h+25 -00 replies
15/17block: Rewrite bdrv_next()block.c+14 -30 replies
16/17block: Use bdrv_next() instead of bdrv_statesblock.c+6 -60 replies
17/17block: Remove bdrv_states listblock.c blockdev.c include/block/block.h +1 more+3 -400 replies

Reviews trailers per patch

5 of 17 patches have a Reviewed-by or Acked-by.

PatchKevin Wolf
1/17
2/17
3/17R-b
4/17R-b
5/17
6/17
7/17
8/17
9/17
10/17
11/17
12/17
13/17
14/17
15/17R-b
16/17R-b
17/17R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [Qemu-devel] [PATCH v4 00/17] blockdev: Further BlockBackend work

This series appears to reinvent itself with every revision. This time, its main implication is that BBs are no longer automatically treated as monitor-owned, and that a BB's name is tightly tied to the monitor reference (it is considered equivalent to that reference).

v4:
- Tightly tied a BB's name to the monitor reference [Kevin]
- Added two patches from my "blockdev: (Nearly) free clean-up work" series which are required so a BB does not need to have a name when bdrv_open() is invoked for its BDS tree
- Added a missing monitor_remove_blk() to the error path of hmp_drive_add() [Kevin]
- v3 just made blk_backends contain all BBs and then added another list called monitor_block_backends. v4 instead renames blk_backends to monitor_block_backends (because both are supposed to be the same, basically) and then adds a new list containing all BBs. [Markus/Kevin]
- blk_hide_on_behalf_of_hmp_drive_del() does a bit more than what monitor_remove_blk() does; namely, it invokes bdrv_make_anon() on the BDS. We should probably continue to do so.
- Use blk_is_inserted() instead of blk_is_available() for blk_commit_all() [Kevin]

Patch justifications:
- 1: General clean-up.
- 2: Clean-up which is nice to have for patch 7 which renames blk_backends to monitor_block_backends.
- 3: In order to move bdrv_commit_all() to the BB level (patch 12), first we need to introduce a BB-level function...
- 4: ...and then we have to use it.
- 5: After this series, BBs will no longer have a name before monitor_add_blk() is called; therefore, we should not try to print the device name when an image is opened (the filename is more interesting anyway)
- 6: Similarily to patch 5, this removes the device name from an error message emitted during image opening.
- 7: blk_backends to me personally implies this was a list of all BlockBackends. It actually is not. Therefore, this patch renames it to a more precise monitor_block_backends.
- 8: As this series makes it more clear that not all BlockBackends need to be referenced by the monitor, this patch consequently adds a list of truly and unconditionally all BlockBackends for whenever we need to iterate through really all of them.
- 9: This patch moves the name management for BlockBackends from blk_new(), blk_delete() and blk_hide_on_behalf_of_hmp_drive_del() into new functions monitor_add_blk() and monitor_remove_blk(). These functions are still invoked in blk_new() etc., so nothing changes to the outside yet.
- 10: This patch drops the implicit calls of monitor_add_blk() and monitor_remove_blk() and thus makes the distinction between a BB's existence and whether it is owned by the monitor externally visible.
- 11: Clean-up patch.
- 12: More or less a clean-up patch.
- 13: Required so we can drop bdrv_states.
- 14: Required so we can drop bdrv_states.
- 15: Required so we can drop bdrv_states.
- 16: Clean-up and required so we can drop bdrv_states.
- 17: Clean-up and preparation for the follow-up series.

git backport-diff against v3:

Key:
[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch [down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively

001/17:[----] [--] 'monitor: Use BB list for BB name completion' 002/17:[down] 'block: Use blk_next() in block-backend.c' 003/17:[----] [--] 'block: Add blk_commit_all()'
004/17:[----] [--] 'block: Use blk_{commit,flush}_all() consistently' 005/17:[down] 'qapi: Drop QERR_UNKNOWN_BLOCK_FORMAT_FEATURE' 006/17:[down] 'block: Drop BB name from bad option error' 007/17:[down] 'blockdev: Rename blk_backends'
008/17:[down] 'blockdev: Add list of all BlockBackends' 009/17:[down] 'blockdev: Separate BB name management' 010/17:[down] 'blockdev: Split monitor reference from BB creation' 011/17:[0014] [FC] 'blockdev: Remove blk_hide_on_behalf_of_hmp_drive_del()' 012/17:[0002] [FC] 'block: Move some bdrv_*_all() functions to BB' 013/17:[0002] [FC] 'block: Add bdrv_next_monitor_owned()' 014/17:[----] [-C] 'block: Add blk_next_root_bs()' 015/17:[----] [--] 'block: Rewrite bdrv_next()'
016/17:[----] [--] 'block: Use bdrv_next() instead of bdrv_states' 017/17:[----] [-C] 'block: Remove bdrv_states list'

Max Reitz (17):
monitor: Use BB list for BB name completion
block: Use blk_next() in block-backend.c
block: Add blk_commit_all()
block: Use blk_{commit,flush}_all() consistently
qapi: Drop QERR_UNKNOWN_BLOCK_FORMAT_FEATURE
block: Drop BB name from bad option error
blockdev: Rename blk_backends
blockdev: Add list of all BlockBackends
blockdev: Separate BB name management
blockdev: Split monitor reference from BB creation
blockdev: Remove blk_hide_on_behalf_of_hmp_drive_del()
block: Move some bdrv_*_all() functions to BB
block: Add bdrv_next_monitor_owned()
block: Add blk_next_root_bs()
block: Rewrite bdrv_next()
block: Use bdrv_next() instead of bdrv_states
block: Remove bdrv_states list

 block.c                                       |  86 +++-------
 block/block-backend.c                         | 228 ++++++++++++++++++--------
 block/io.c                                    |  20 ---
 block/parallels.c                             |   2 +-
 block/qcow.c                                  |   8 +-
 block/qcow2.c                                 |  30 +---
 block/qed.c                                   |   9 +-
 block/sheepdog.c                              |   4 +-
 block/vdi.c                                   |   2 +-
 block/vhdx.c                                  |   2 +-
 block/vmdk.c                                  |  13 +-
 block/vpc.c                                   |   2 +-
 blockdev.c                                    |  44 +++--
 cpus.c                                        |   5 +-
 device-hotplug.c                              |   4 +-
 hw/block/xen_disk.c                           |   2 +-
 include/block/block.h                         |   4 +-
 include/block/block_int.h                     |   4 -
 include/qapi/qmp/qerror.h                     |   3 -
 include/sysemu/block-backend.h                |  15 +-
 monitor.c                                     |   7 +-
 qemu-char.c                                   |   3 +-
 qemu-img.c                                    |  50 +++---
 qemu-io.c                                     |   2 +-
 qemu-nbd.c                                    |   4 +-
 stubs/Makefile.objs                           |   3 +-
 stubs/bdrv-next-monitor-owned.c               |   8 +
 stubs/{bdrv-commit-all.c => blk-commit-all.c} |   4 +-
 tests/qemu-iotests/036.out                    |  16 +-
 tests/qemu-iotests/051.out                    |   8 +-
 tests/qemu-iotests/051.pc.out                 |   8 +-
 tests/qemu-iotests/087.out                    |   2 +-
 32 files changed, 310 insertions(+), 292 deletions(-)
 create mode 100644 stubs/bdrv-next-monitor-owned.c
 rename stubs/{bdrv-commit-all.c => blk-commit-all.c} (53%)
Signature · 1 line
2.7.3