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%) -- 2.7.3