block: Add blk_remove_all_bs()
authorMax Reitz <mreitz@redhat.com>
Fri, 29 Jan 2016 15:36:13 +0000 (16:36 +0100)
committerMax Reitz <mreitz@redhat.com>
Tue, 2 Feb 2016 16:50:46 +0000 (17:50 +0100)
commitd8da3cef3bc649492d190e029343293df1386027
tree312ba1cebe17b03320bb07613d94fb0d9c3314bd
parent9c4218e957331e1ba0ba7565730b0b71c49b8d70
block: Add blk_remove_all_bs()

When bdrv_close_all() is called, instead of force-closing all root
BlockDriverStates, it is better to just drop the reference from all
BlockBackends and let them be closed automatically. This prevents BDS
from getting closed that are still referenced by other BDS, which may
result in loss of cached data.

This patch adds a function for doing that, but does not yet incorporate
it in bdrv_close_all().

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/block-backend.c
include/sysemu/block-backend.h