Skip to contentSkip to conversation

dirty-bitmap: Expose persistent flag to 'query-block'

PATCH Superseded Eric Blake 3 participants 4 messages Feb 4, 2019 Block layer

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Eric Blake

author
#0 lore raw

PATCH 1/1 dirty-bitmap: Expose persistent flag to 'query-block'

Since qemu currently doesn't flush persistent bitmaps to disk until shutdown (which might be MUCH later), it's useful if 'query-block' at least shows WHICH bitmaps will (eventually) make it to persistent storage.

---
 qapi/block-core.json | 5 ++++-
 block/dirty-bitmap.c | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)
qapi/block-core.json +4 -1
index dae5c7b4d83..2e0bd3c245a 100644
@@ -450,11 +450,14 @@
 #
 # @status: current status of the dirty bitmap (since 2.4)
 #
+# @persistent: true if the bitmap will eventually be flushed to persistent
+#              storage (since 4.0)
+#
 # Since: 1.3
 ##
 { 'struct': 'BlockDirtyInfo',
   'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
-           'status': 'DirtyBitmapStatus'} }
+           'status': 'DirtyBitmapStatus', 'persistent': 'bool' } }
 
 ##
 # @Qcow2BitmapInfoFlags:
block/dirty-bitmap.c +1 -0
index 00ea36f5545..e46f72b346c 100644
@@ -440,6 +440,7 @@ BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs)
         info->has_name = !!bm->name;
         info->name = g_strdup(bm->name);
         info->status = bdrv_dirty_bitmap_status(bm);
+        info->persistent = bm->persistent;
         entry->value = info;
         *plist = entry;
         plist = &entry->next;
Signature · 1 line
2.20.1
#3 lore raw
In reply to Eric Blake
Quoted 37 lines · Eric Blake

Since qemu currently doesn't flush persistent bitmaps to disk until shutdown (which might be MUCH later), it's useful if 'query-block' at least shows WHICH bitmaps will (eventually) make it to persistent storage.

---
 qapi/block-core.json | 5 ++++-
 block/dirty-bitmap.c | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)
qapi/block-core.json +4 -1
index dae5c7b4d83..2e0bd3c245a 100644
@@ -450,11 +450,14 @@
 #
 # @status: current status of the dirty bitmap (since 2.4)
 #
+# @persistent: true if the bitmap will eventually be flushed to persistent
+#              storage (since 4.0)
+#
 # Since: 1.3
 ##
 { 'struct': 'BlockDirtyInfo',
   'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32',
-           'status': 'DirtyBitmapStatus'} }
+           'status': 'DirtyBitmapStatus', 'persistent': 'bool' } }
 
 ##
 # @Qcow2BitmapInfoFlags:
block/dirty-bitmap.c +0 -0
index 00ea36f5545..e46f72b346c 100644

block/dirty-bitmap.c BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs) · line 446

Quoted 7 lines
block/dirty-bitmap.c +1 -0
@@ -440,6 +440,7 @@ BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs)
         info->has_name = !!bm->name;
         info->name = g_strdup(bm->name);
         info->status = bdrv_dirty_bitmap_status(bm);
+        info->persistent = bm->persistent;
         entry->value = info;
         *plist = entry;
         plist = &entry->next;

Oh, this needs a change to 236, too.

--js