[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 08/31] block: Assert !bs->refcnt in bdrv_close()
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 08/31] block: Assert !bs->refcnt in bdrv_close() |
Date: |
Wed, 25 May 2016 19:39:33 +0200 |
From: Max Reitz <address@hidden>
The only caller of bdrv_close() left is bdrv_delete(). We may as well
assert that, in a way (there are some things in bdrv_close() that make
more sense under that assumption, such as the call to
bdrv_release_all_dirty_bitmaps() which in turn assumes that no frozen
bitmaps are attached to the BDS).
In addition, being called only in bdrv_delete() means that we can drop
bdrv_close()'s forward declaration at the top of block.c.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/block.c b/block.c
index ad4be90..4c021c0 100644
--- a/block.c
+++ b/block.c
@@ -74,8 +74,6 @@ static BlockDriverState *bdrv_open_inherit(const char
*filename,
/* If non-zero, use only whitelisted block drivers */
static int use_bdrv_whitelist;
-static void bdrv_close(BlockDriverState *bs);
-
#ifdef _WIN32
static int is_windows_drive_prefix(const char *filename)
{
@@ -2110,6 +2108,7 @@ static void bdrv_close(BlockDriverState *bs)
BdrvAioNotifier *ban, *ban_next;
assert(!bs->job);
+ assert(!bs->refcnt);
bdrv_drained_begin(bs); /* complete I/O */
bdrv_flush(bs);
--
1.8.3.1
- [Qemu-devel] [PULL 27/31] qemu-iotests: Some more write_zeroes tests, (continued)
- [Qemu-devel] [PULL 27/31] qemu-iotests: Some more write_zeroes tests, Kevin Wolf, 2016/05/19
- [Qemu-devel] [PULL 23/31] block: Remove BlockDriverState.blk, Kevin Wolf, 2016/05/19
- [Qemu-devel] [PULL 31/31] qemu-iotests: Fix regression in 136 on aio_read invalid, Kevin Wolf, 2016/05/19
- [Qemu-devel] [PULL 29/31] qemu-io: Fix recent UI updates, Kevin Wolf, 2016/05/19
- Re: [Qemu-devel] [PULL 00/31] Block layer patches, Peter Maydell, 2016/05/19
- [Qemu-devel] [PULL 00/31] Block layer patches, Kevin Wolf, 2016/05/25
- [Qemu-devel] [PULL 02/31] block: Drop useless bdrv_new() call, Kevin Wolf, 2016/05/25
- [Qemu-devel] [PULL 01/31] block: Fix bdrv_next() memory leak, Kevin Wolf, 2016/05/25
- [Qemu-devel] [PULL 03/31] block: Let bdrv_open_inherit() return the snapshot, Kevin Wolf, 2016/05/25
- [Qemu-devel] [PULL 06/31] block: Drop bdrv_new_root(), Kevin Wolf, 2016/05/25
- [Qemu-devel] [PULL 08/31] block: Assert !bs->refcnt in bdrv_close(),
Kevin Wolf <=
- [Qemu-devel] [PULL 05/31] block: Drop blk_new_with_bs(), Kevin Wolf, 2016/05/25
- [Qemu-devel] [PULL 09/31] block: Drop bdrv_parent_cb_...() from bdrv_close(), Kevin Wolf, 2016/05/25
- [Qemu-devel] [PULL 04/31] tests: Drop BDS from test-throttle.c, Kevin Wolf, 2016/05/25
- [Qemu-devel] [PULL 10/31] block: Drop errp parameter from blk_new(), Kevin Wolf, 2016/05/25
- [Qemu-devel] [PULL 13/31] block: Fix reconfiguring graph with drained nodes, Kevin Wolf, 2016/05/25
- [Qemu-devel] [PULL 11/31] block: Introduce bdrv_replace_child(), Kevin Wolf, 2016/05/25
- [Qemu-devel] [PULL 20/31] block: Default to enabled write cache in blk_new(), Kevin Wolf, 2016/05/25
- [Qemu-devel] [PULL 07/31] block: Make bdrv_open() return a BDS, Kevin Wolf, 2016/05/25
- [Qemu-devel] [PULL 14/31] block: Propagate .drained_begin/end callbacks, Kevin Wolf, 2016/05/25
- [Qemu-devel] [PULL 12/31] block: Make bdrv_drain() use bdrv_drained_begin/end(), Kevin Wolf, 2016/05/25