At this point, the main merit of this series is to remove blk_hide_on_behalf_of_hmp_drive_del() and the bdrv_states list. A follow-up to it will make bdrv_open() return a BDS pointer.
v3: It certainly feels like pretty much a rewrite, and git-backport-diff thinks so, too. The general idea was to be less strict about making everyone use blk_next() instead of bdrv_next(), which is for instance why patch 4 shrunk by a lot. Also, some functions do not make any sense on the BB level (such as blk_invalidate_cache_all()), so they are no longer added here. I'll try my best to give a patch-by-patch diff (patch indices are given as [this series]/[last series]): - Patch 1/4: I split the original patch 4 into multiple patches and dropped the largest portion. This is the first patch of what is left. - Patch 2/4: Second part of the original patch 4. - Patch 3/-: Added, because it's needed for patch 11. Comes so early because we can use it in patches 4 and 9, too. - Patch 4/1: Use blk_all_next() instead of QTAILQ_FOREACH() over blk_backends. - Patch -/2: Dropped. With all the modifications, I did not have any user left. - Patch 5/3: blk_invalidate_cache_all() is no longer added by this series [Kevin], so this patch does not need to add it; it only needs to add blk_commit_all(). - Patch 6/4: Third and final part of the original patch 4. - Patch 7/5: Actually pretty much unchanged, there is only a contextual conflict because blk_next_inserted() is missing now which git-backport-diff decided to consider a functional conflict. - Patch 8/6: Unchanged, except I updated the comment in hmp_drive_del() now. - Patch 9/7: Only bdrv_commit_all() and bdrv_flush_all() are moved; bdrv_invalidate_cache_all() and bdrv_drain_all() are kept where they are. [Kevin] - Patch 10/-: Added, because it's needed for patch 12. - Patch 11/-: Added, because it's needed for patch 12. - Patch 12/-: Because we have to keep bdrv_invalidate_cache_all() and bdrv_drain_all() on the root BDS level, we will have to keep some form of bdrv_next(). Managing bdrv_states is ugly and error-prone, though, so it would be nicer if all root BDSs were visible through bdrv_next() without having to explicitly register them in a special list. This patch rewrites bdrv_next() so it iterates over all BB-attached and all monitor-owned BDSs, which I hope are then all the root BDSs we need. - Patch 13/-: Now I decided to keep bdrv_next() but still remove bdrv_states, so this patch makes the remaining users of bdrv_states use bdrv_next() and thus makes patch 14 possible. - Patch 14/8: Rebase conflicts and no longer removes bdrv_next(). For the sake of completeness, here is the backport-diff against v2: 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/14:[down] 'monitor: Use BB list for BB name completion' 002/14:[down] 'block: Use blk_next() where appropriate' 003/14:[down] 'block: Add blk_all_next()' 004/14:[0004] [FC] 'block: Add blk_name_taken()' 005/14:[down] 'block: Add blk_commit_all()' 006/14:[down] 'block: Use blk_{commit,flush}_all() consistently' 007/14:[0006] [FC] 'blockdev: Add list of monitor-owned BlockBackends' 008/14:[0006] [FC] 'blockdev: Remove blk_hide_on_behalf_of_hmp_drive_del()' 009/14:[0204] [FC] 'block: Move some bdrv_*_all() functions to BB' 010/14:[down] 'block: Add bdrv_next_monitor_owned()' 011/14:[down] 'block: Add blk_next_root_bs()' 012/14:[down] 'block: Rewrite bdrv_next()' 013/14:[down] 'block: Use bdrv_next() instead of bdrv_states' 014/14:[down] 'block: Remove bdrv_states list' Max Reitz (14): monitor: Use BB list for BB name completion block: Use blk_next() where appropriate block: Add blk_all_next() block: Add blk_name_taken() block: Add blk_commit_all() block: Use blk_{commit,flush}_all() consistently blockdev: Add list of monitor-owned BlockBackends 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 | 84 ++++--------- block/block-backend.c | 171 ++++++++++++++++++++------ block/io.c | 20 --- blockdev.c | 31 +++-- cpus.c | 5 +- include/block/block.h | 4 +- include/block/block_int.h | 4 - include/sysemu/block-backend.h | 7 +- monitor.c | 7 +- qemu-char.c | 3 +- stubs/Makefile.objs | 3 +- stubs/bdrv-next-monitor-owned.c | 6 + stubs/{bdrv-commit-all.c => blk-commit-all.c} | 4 +- 13 files changed, 203 insertions(+), 146 deletions(-) create mode 100644 stubs/bdrv-next-monitor-owned.c rename stubs/{bdrv-commit-all.c => blk-commit-all.c} (53%) -- 2.7.1