[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH 2/5] qapi: add x-block-dirty-bitmap-enable/disab
From: |
Jeff Cody |
Subject: |
Re: [Qemu-block] [PATCH 2/5] qapi: add x-block-dirty-bitmap-enable/disable |
Date: |
Wed, 6 Jun 2018 09:21:41 -0400 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
On Tue, Jun 05, 2018 at 02:59:02PM -0400, John Snow wrote:
> Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
> [Added x- prefix. --js]
> Signed-off-by: John Snow <address@hidden>
> ---
> blockdev.c | 42 ++++++++++++++++++++++++++++++++++++++++++
> qapi/block-core.json | 42 ++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 84 insertions(+)
>
> diff --git a/blockdev.c b/blockdev.c
> index 8de95be8f4..5f059cedcb 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -2923,6 +2923,48 @@ void qmp_block_dirty_bitmap_clear(const char *node,
> const char *name,
> bdrv_clear_dirty_bitmap(bitmap, NULL);
> }
>
> +void qmp_x_block_dirty_bitmap_enable(const char *node, const char *name,
> + Error **errp)
> +{
> + BlockDriverState *bs;
> + BdrvDirtyBitmap *bitmap;
> +
> + bitmap = block_dirty_bitmap_lookup(node, name, &bs, errp);
> + if (!bitmap || !bs) {
Same comment on !bs here as on patch 4.
> + return;
> + }
> +
> + if (bdrv_dirty_bitmap_frozen(bitmap)) {
> + error_setg(errp,
> + "Bitmap '%s' is currently frozen and cannot be enabled",
> + name);
> + return;
> + }
> +
> + bdrv_enable_dirty_bitmap(bitmap);
> +}
> +
> +void qmp_x_block_dirty_bitmap_disable(const char *node, const char *name,
> + Error **errp)
> +{
> + BlockDriverState *bs;
> + BdrvDirtyBitmap *bitmap;
> +
> + bitmap = block_dirty_bitmap_lookup(node, name, &bs, errp);
> + if (!bitmap || !bs) {
Ditto
> + return;
> + }
> +
> + if (bdrv_dirty_bitmap_frozen(bitmap)) {
> + error_setg(errp,
> + "Bitmap '%s' is currently frozen and cannot be disabled",
> + name);
> + return;
> + }
> +
> + bdrv_disable_dirty_bitmap(bitmap);
> +}
> +
> BlockDirtyBitmapSha256 *qmp_x_debug_block_dirty_bitmap_sha256(const char
> *node,
> const char
> *name,
> Error **errp)
> diff --git a/qapi/block-core.json b/qapi/block-core.json
> index 4b1de474a9..c061884a0e 100644
> --- a/qapi/block-core.json
> +++ b/qapi/block-core.json
> @@ -1808,6 +1808,48 @@
> { 'command': 'block-dirty-bitmap-clear',
> 'data': 'BlockDirtyBitmap' }
>
> +##
> +# @x-block-dirty-bitmap-enable:
> +#
> +# Enables a dirty bitmap so that it will begin tracking disk changes.
> +#
> +# Returns: nothing on success
> +# If @node is not a valid block device, DeviceNotFound
> +# If @name is not found, GenericError with an explanation
> +#
> +# Since: 2.12
Since: 3.00
> +#
> +# Example:
> +#
> +# -> { "execute": "x-block-dirty-bitmap-enable",
> +# "arguments": { "node": "drive0", "name": "bitmap0" } }
> +# <- { "return": {} }
> +#
> +##
> + { 'command': 'x-block-dirty-bitmap-enable',
> + 'data': 'BlockDirtyBitmap' }
> +
> +##
> +# @x-block-dirty-bitmap-disable:
> +#
> +# Disables a dirty bitmap so that it will stop tracking disk changes.
> +#
> +# Returns: nothing on success
> +# If @node is not a valid block device, DeviceNotFound
> +# If @name is not found, GenericError with an explanation
> +#
> +# Since: 2.12
Since: 3.00
> +#
> +# Example:
> +#
> +# -> { "execute": "x-block-dirty-bitmap-disable",
> +# "arguments": { "node": "drive0", "name": "bitmap0" } }
> +# <- { "return": {} }
> +#
> +##
> + { 'command': 'x-block-dirty-bitmap-disable',
> + 'data': 'BlockDirtyBitmap' }
> +
> ##
> # @BlockDirtyBitmapSha256:
> #
> --
> 2.14.3
>
>
- [Qemu-block] [PATCH 0/5] block dirty bitmaps: support libvirt API, John Snow, 2018/06/05
- [Qemu-block] [PATCH 3/5] qmp: transaction support for x-block-dirty-bitmap-enable/disable, John Snow, 2018/06/05
- [Qemu-block] [PATCH 1/5] block/dirty-bitmap: add lock to bdrv_enable/disable_dirty_bitmap, John Snow, 2018/06/05
- [Qemu-block] [PATCH 2/5] qapi: add x-block-dirty-bitmap-enable/disable, John Snow, 2018/06/05
- [Qemu-block] [PATCH 4/5] qapi: add x-block-dirty-bitmap-merge, John Snow, 2018/06/05
- [Qemu-block] [PATCH 5/5] qapi: add disabled parameter to block-dirty-bitmap-add, John Snow, 2018/06/05