[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH 17/25] qmp: add autoload parameter to block-dirty-bi
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[Qemu-block] [PATCH 17/25] qmp: add autoload parameter to block-dirty-bitmap-add |
Date: |
Tue, 14 Feb 2017 19:59:31 +0300 |
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>
---
blockdev.c | 18 ++++++++++++++++--
qapi/block-core.json | 6 +++++-
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 40605fa..e32ac69 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1968,6 +1968,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) {
@@ -2698,6 +2699,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)
{
AioContext *aio_context;
@@ -2731,6 +2733,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");
+ goto out;
+ }
if (persistent &&
!bdrv_can_store_new_dirty_bitmap(bs, name, granularity, errp))
@@ -2739,10 +2750,13 @@ 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) {
+ goto out;
}
+ bdrv_dirty_bitmap_set_persistance(bitmap, persistent);
+ bdrv_dirty_bitmap_set_autoload(bitmap, autoload);
+
out:
aio_context_release(aio_context);
}
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 535df20..09dcf4e 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -1564,11 +1564,15 @@
# Qcow2 disks support persistent bitmaps. Default is false.
# (Since 2.9)
#
+# @autoload: #optional 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. (Since 2.9)
+#
# Since: 2.4
##
{ 'struct': 'BlockDirtyBitmapAdd',
'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
- '*persistent': 'bool' } }
+ '*persistent': 'bool', '*autoload': 'bool' } }
##
# @block-dirty-bitmap-add:
--
1.8.3.1
- [Qemu-block] [PATCH 02/25] specs/qcow2: do not use wording 'bitmap header', (continued)
- [Qemu-block] [PATCH 02/25] specs/qcow2: do not use wording 'bitmap header', Vladimir Sementsov-Ogievskiy, 2017/02/14
- [Qemu-block] [PATCH 21/25] qcow2-bitmap: refcounts, Vladimir Sementsov-Ogievskiy, 2017/02/14
- [Qemu-block] [PATCH 01/25] specs/qcow2: fix bitmap granularity qemu-specific note, Vladimir Sementsov-Ogievskiy, 2017/02/14
- [Qemu-block] [PATCH 08/25] block: introduce auto-loading bitmaps, Vladimir Sementsov-Ogievskiy, 2017/02/14
- [Qemu-block] [PATCH 23/25] qcow2: add .bdrv_remove_persistent_dirty_bitmap, Vladimir Sementsov-Ogievskiy, 2017/02/14
- [Qemu-block] [PATCH 07/25] qcow2: add bitmaps extension, Vladimir Sementsov-Ogievskiy, 2017/02/14
- [Qemu-block] [PATCH 19/25] iotests: test qcow2 persistent dirty bitmap, Vladimir Sementsov-Ogievskiy, 2017/02/14
- [Qemu-block] [PATCH 17/25] qmp: add autoload parameter to block-dirty-bitmap-add,
Vladimir Sementsov-Ogievskiy <=
- [Qemu-block] [PATCH 20/25] qcow2-refcount: rename inc_refcounts() and make it public, Vladimir Sementsov-Ogievskiy, 2017/02/14
- [Qemu-block] [PATCH 14/25] block: add bdrv_can_store_new_dirty_bitmap, Vladimir Sementsov-Ogievskiy, 2017/02/14
- [Qemu-block] [PATCH 10/25] block/dirty-bitmap: add autoload field to BdrvDirtyBitmap, Vladimir Sementsov-Ogievskiy, 2017/02/14
- [Qemu-block] [PATCH 15/25] qcow2: add .bdrv_can_store_new_dirty_bitmap, Vladimir Sementsov-Ogievskiy, 2017/02/14
- [Qemu-block] [PATCH 11/25] block: introduce persistent dirty bitmaps, Vladimir Sementsov-Ogievskiy, 2017/02/14
- [Qemu-block] [PATCH 03/25] hbitmap: improve dirty iter, Vladimir Sementsov-Ogievskiy, 2017/02/14