mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
block: implement reference count for BlockDriverState
Introduce bdrv_ref/bdrv_unref to manage the lifecycle of BlockDriverState. They are unused for now but will used to replace bdrv_delete() later. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
13c91cb7e2
commit
9fcb025146
3 changed files with 24 additions and 0 deletions
|
@ -355,6 +355,8 @@ int64_t bdrv_get_dirty_count(BlockDriverState *bs);
|
|||
void bdrv_enable_copy_on_read(BlockDriverState *bs);
|
||||
void bdrv_disable_copy_on_read(BlockDriverState *bs);
|
||||
|
||||
void bdrv_ref(BlockDriverState *bs);
|
||||
void bdrv_unref(BlockDriverState *bs);
|
||||
void bdrv_set_in_use(BlockDriverState *bs, int in_use);
|
||||
int bdrv_in_use(BlockDriverState *bs);
|
||||
|
||||
|
|
|
@ -277,6 +277,7 @@ struct BlockDriverState {
|
|||
BlockDeviceIoStatus iostatus;
|
||||
char device_name[32];
|
||||
HBitmap *dirty_bitmap;
|
||||
int refcnt;
|
||||
int in_use; /* users other than guest access, eg. block migration */
|
||||
QTAILQ_ENTRY(BlockDriverState) list;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue