[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 46/85] qmp: add autoload parameter to block-dirty-bit
From: |
Max Reitz |
Subject: |
[Qemu-block] [PULL 46/85] qmp: add autoload parameter to block-dirty-bitmap-add |
Date: |
Tue, 11 Jul 2017 18:07:35 +0200 |
From: Vladimir Sementsov-Ogievskiy <address@hidden>
Optional. Default is false.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Signed-off-by: Denis V. Lunev <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Reviewed-by: John Snow <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
qapi/block-core.json | 6 +++++-
blockdev.c | 18 ++++++++++++++++--
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 907ac9d..fb69efe 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -1558,11 +1558,15 @@
# Qcow2 disks support persistent bitmaps. Default is false for
# block-dirty-bitmap-add. (Since: 2.10)
#
+# @autoload: the bitmap will be automatically loaded when the image it is
stored
+# in is opened. This flag may only be specified for persistent
+# bitmaps. Default is false for block-dirty-bitmap-add. (Since:
2.10)
+#
# Since: 2.4
##
{ 'struct': 'BlockDirtyBitmapAdd',
'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
- '*persistent': 'bool' } }
+ '*persistent': 'bool', '*autoload': 'bool' } }
##
# @block-dirty-bitmap-add:
diff --git a/blockdev.c b/blockdev.c
index 2ef731b..b7c1449 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1984,6 +1984,7 @@ static void block_dirty_bitmap_add_prepare(BlkActionState
*common,
qmp_block_dirty_bitmap_add(action->node, action->name,
action->has_granularity, action->granularity,
action->has_persistent, action->persistent,
+ action->has_autoload, action->autoload,
&local_err);
if (!local_err) {
@@ -2710,6 +2711,7 @@ out:
void qmp_block_dirty_bitmap_add(const char *node, const char *name,
bool has_granularity, uint32_t granularity,
bool has_persistent, bool persistent,
+ bool has_autoload, bool autoload,
Error **errp)
{
BlockDriverState *bs;
@@ -2739,6 +2741,15 @@ void qmp_block_dirty_bitmap_add(const char *node, const
char *name,
if (!has_persistent) {
persistent = false;
}
+ if (!has_autoload) {
+ autoload = false;
+ }
+
+ if (has_autoload && !persistent) {
+ error_setg(errp, "Autoload flag must be used only for persistent "
+ "bitmaps");
+ return;
+ }
if (persistent &&
!bdrv_can_store_new_dirty_bitmap(bs, name, granularity, errp))
@@ -2747,9 +2758,12 @@ void qmp_block_dirty_bitmap_add(const char *node, const
char *name,
}
bitmap = bdrv_create_dirty_bitmap(bs, granularity, name, errp);
- if (bitmap != NULL) {
- bdrv_dirty_bitmap_set_persistance(bitmap, persistent);
+ if (bitmap == NULL) {
+ return;
}
+
+ bdrv_dirty_bitmap_set_persistance(bitmap, persistent);
+ bdrv_dirty_bitmap_set_autoload(bitmap, autoload);
}
void qmp_block_dirty_bitmap_remove(const char *node, const char *name,
--
2.9.4
- [Qemu-block] [PULL 38/85] block: bdrv_close: release bitmaps after drv->bdrv_close, (continued)
- [Qemu-block] [PULL 38/85] block: bdrv_close: release bitmaps after drv->bdrv_close, Max Reitz, 2017/07/11
- [Qemu-block] [PULL 37/85] block/dirty-bitmap: add autoload field to BdrvDirtyBitmap, Max Reitz, 2017/07/11
- [Qemu-block] [PULL 36/85] qcow2: support .bdrv_reopen_bitmaps_rw, Max Reitz, 2017/07/11
- [Qemu-block] [PULL 39/85] block: introduce persistent dirty bitmaps, Max Reitz, 2017/07/11
- [Qemu-block] [PULL 40/85] block/dirty-bitmap: add bdrv_dirty_bitmap_next(), Max Reitz, 2017/07/11
- [Qemu-block] [PULL 41/85] qcow2: add persistent dirty bitmaps support, Max Reitz, 2017/07/11
- [Qemu-block] [PULL 42/85] qcow2: store bitmaps on reopening image as read-only, Max Reitz, 2017/07/11
- [Qemu-block] [PULL 44/85] qcow2: add .bdrv_can_store_new_dirty_bitmap, Max Reitz, 2017/07/11
- [Qemu-block] [PULL 43/85] block: add bdrv_can_store_new_dirty_bitmap, Max Reitz, 2017/07/11
- [Qemu-block] [PULL 45/85] qmp: add persistent flag to block-dirty-bitmap-add, Max Reitz, 2017/07/11
- [Qemu-block] [PULL 46/85] qmp: add autoload parameter to block-dirty-bitmap-add,
Max Reitz <=
- [Qemu-block] [PULL 48/85] iotests: test qcow2 persistent dirty bitmap, Max Reitz, 2017/07/11
- [Qemu-block] [PULL 47/85] qmp: add x-debug-block-dirty-bitmap-sha256, Max Reitz, 2017/07/11
- [Qemu-block] [PULL 49/85] block/dirty-bitmap: add bdrv_remove_persistent_dirty_bitmap, Max Reitz, 2017/07/11
- [Qemu-block] [PULL 50/85] qcow2: add .bdrv_remove_persistent_dirty_bitmap, Max Reitz, 2017/07/11
- [Qemu-block] [PULL 52/85] block: release persistent bitmaps on inactivate, Max Reitz, 2017/07/11
- [Qemu-block] [PULL 51/85] qmp: block-dirty-bitmap-remove: remove persistent, Max Reitz, 2017/07/11