[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH 17/25] qmp: add autoload parameter
From: |
John Snow |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH 17/25] qmp: add autoload parameter to block-dirty-bitmap-add |
Date: |
Tue, 14 Feb 2017 17:43:32 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
On 02/14/2017 11:59 AM, Vladimir Sementsov-Ogievskiy wrote:
> 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;
> + }
>
Good, glad we have this case covered.
> 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:
>
Looks good to me.
Reviewed-by: John Snow <address@hidden>
- [Qemu-block] [PATCH 21/25] qcow2-bitmap: refcounts, (continued)
- [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, 2017/02/14
- Re: [Qemu-block] [Qemu-devel] [PATCH 17/25] qmp: add autoload parameter to block-dirty-bitmap-add,
John Snow <=
- [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
- [Qemu-block] [PATCH 13/25] qcow2: add .bdrv_store_persistent_dirty_bitmaps(), Vladimir Sementsov-Ogievskiy, 2017/02/14