提交 b9a9b3a4 编写于 作者: P Paolo Bonzini 提交者: Kevin Wolf

block: export dirty bitmap information in query-block

Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
上级 1755da16
......@@ -2837,6 +2837,13 @@ BlockInfo *bdrv_query_info(BlockDriverState *bs)
info->io_status = bs->iostatus;
}
if (bs->dirty_bitmap) {
info->has_dirty = true;
info->dirty = g_malloc0(sizeof(*info->dirty));
info->dirty->count = bdrv_get_dirty_count(bs) *
BDRV_SECTORS_PER_DIRTY_CHUNK * BDRV_SECTOR_SIZE;
}
if (bs->drv) {
info->has_inserted = true;
info->inserted = g_malloc0(sizeof(*info->inserted));
......
......@@ -660,6 +660,18 @@
##
{ 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
##
# @BlockDirtyInfo:
#
# Block dirty bitmap information.
#
# @count: number of dirty bytes according to the dirty bitmap
#
# Since: 1.3
##
{ 'type': 'BlockDirtyInfo',
'data': {'count': 'int'} }
##
# @BlockInfo:
#
......@@ -679,6 +691,9 @@
# @tray_open: #optional True if the device has a tray and it is open
# (only present if removable is true)
#
# @dirty: #optional dirty bitmap information (only present if the dirty
# bitmap is enabled)
#
# @io-status: #optional @BlockDeviceIoStatus. Only present if the device
# supports it and the VM is configured to stop on errors
#
......@@ -690,7 +705,8 @@
{ 'type': 'BlockInfo',
'data': {'device': 'str', 'type': 'str', 'removable': 'bool',
'locked': 'bool', '*inserted': 'BlockDeviceInfo',
'*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus'} }
'*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
'*dirty': 'BlockDirtyInfo' } }
##
# @query-block:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册