aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2013-11-13 18:29:44 +0800
committerKevin Wolf <kwolf@redhat.com>2013-11-29 13:40:36 +0100
commit21b568350861a2c6eedfef95b70f88faf2fbd32a (patch)
tree67a77d713748969e31bc11e4ea682bc8558aa0a3 /block.c
parente4654d2d9406016d6e4e296ba8db3d118caf9ff6 (diff)
qapi: Change BlockDirtyInfo to list
We have multiple dirty bitmaps in BDS now, switch QAPI to allow query it (BlockInfo.dirty_bitmaps), and also drop old BlockInfo.dirty. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/block.c b/block.c
index d792d53dd5..765bbae41a 100644
--- a/block.c
+++ b/block.c
@@ -4522,6 +4522,26 @@ void bdrv_release_dirty_bitmap(BlockDriverState *bs, BdrvDirtyBitmap *bitmap)
}
}
+BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs)
+{
+ BdrvDirtyBitmap *bm;
+ BlockDirtyInfoList *list = NULL;
+ BlockDirtyInfoList **plist = &list;
+
+ QLIST_FOREACH(bm, &bs->dirty_bitmaps, list) {
+ BlockDirtyInfo *info = g_malloc0(sizeof(BlockDirtyInfo));
+ BlockDirtyInfoList *entry = g_malloc0(sizeof(BlockDirtyInfoList));
+ info->count = bdrv_get_dirty_count(bs, bm);
+ info->granularity =
+ ((int64_t) BDRV_SECTOR_SIZE << hbitmap_granularity(bm->bitmap));
+ entry->value = info;
+ *plist = entry;
+ plist = &entry->next;
+ }
+
+ return list;
+}
+
int bdrv_get_dirty(BlockDriverState *bs, BdrvDirtyBitmap *bitmap, int64_t sector)
{
if (bitmap) {