[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [RFC PATCH 08/16] qmp: Add optional parame
From: |
John Snow |
Subject: |
Re: [Qemu-block] [Qemu-devel] [RFC PATCH 08/16] qmp: Add optional parameter "persistent" in block-dirty-bitmap-add |
Date: |
Tue, 9 Feb 2016 17:05:53 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 |
On 01/26/2016 05:38 AM, Fam Zheng wrote:
> When omitted it defaults to false with unchanged behavior.
>
> When set to true, the created dirty bitmap is made persistent if supported, it
> requires support from the active image format. Otherwise an error is returned.
>
> Signed-off-by: Fam Zheng <address@hidden>
> ---
> blockdev.c | 8 +++++++-
> qapi/block-core.json | 6 +++++-
> qmp-commands.hx | 3 ++-
> 3 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/blockdev.c b/blockdev.c
> index 07cfe25..08236f2 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -1997,6 +1997,7 @@ static void
> block_dirty_bitmap_add_prepare(BlkActionState *common,
> /* AIO context taken and released within qmp_block_dirty_bitmap_add */
> qmp_block_dirty_bitmap_add(action->node, action->name,
> action->has_granularity, action->granularity,
> + action->has_persistent, action->persistent,
> &local_err);
>
> if (!local_err) {
> @@ -2640,10 +2641,12 @@ out:
>
> void qmp_block_dirty_bitmap_add(const char *node, const char *name,
> bool has_granularity, uint32_t granularity,
> + bool has_persistent, bool persistent,
> Error **errp)
> {
> AioContext *aio_context;
> BlockDriverState *bs;
> + BdrvDirtyBitmap *bitmap;
>
> if (!name || name[0] == '\0') {
> error_setg(errp, "Bitmap name cannot be empty");
> @@ -2669,7 +2672,10 @@ void qmp_block_dirty_bitmap_add(const char *node,
> const char *name,
> granularity = bdrv_get_default_bitmap_granularity(bs);
> }
>
> - bdrv_create_dirty_bitmap(bs, granularity, name, errp);
> + bitmap = bdrv_create_dirty_bitmap(bs, granularity, name, errp);
> + if (bitmap && has_persistent && persistent) {
> + bdrv_dirty_bitmap_set_persistent(bs, bitmap, true, false, errp);
> + }
>
> out:
> aio_context_release(aio_context);
> diff --git a/qapi/block-core.json b/qapi/block-core.json
> index 30c2e5f..0ac107c 100644
> --- a/qapi/block-core.json
> +++ b/qapi/block-core.json
> @@ -1162,10 +1162,14 @@
> # @granularity: #optional the bitmap granularity, default is 64k for
> # block-dirty-bitmap-add
> #
> +# @persistent: #optinal whether to make the bitmap persistent, default is
> false.
> +# (Since 2.6)
> +#
optional
> # Since 2.4
> ##
> { 'struct': 'BlockDirtyBitmapAdd',
> - 'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32' } }
> + 'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
> + '*persistent': 'bool' } }
>
> ##
> # @block-dirty-bitmap-add
> diff --git a/qmp-commands.hx b/qmp-commands.hx
> index db072a6..bd4428e 100644
> --- a/qmp-commands.hx
> +++ b/qmp-commands.hx
> @@ -1373,7 +1373,7 @@ EQMP
>
> {
> .name = "block-dirty-bitmap-add",
> - .args_type = "node:B,name:s,granularity:i?",
> + .args_type = "node:B,name:s,granularity:i?,persistent:b?",
> .mhandler.cmd_new = qmp_marshal_block_dirty_bitmap_add,
> },
>
> @@ -1390,6 +1390,7 @@ Arguments:
> - "node": device/node on which to create dirty bitmap (json-string)
> - "name": name of the new dirty bitmap (json-string)
> - "granularity": granularity to track writes with (int, optional)
> +- "persistent": whether the bitmap is persistent (bool, optional, default to
> no)
>
> Example:
>
>
With typo fixed:
Reviewed-by: John Snow <address@hidden>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-block] [Qemu-devel] [RFC PATCH 08/16] qmp: Add optional parameter "persistent" in block-dirty-bitmap-add,
John Snow <=