From: John Snow <jsnow@redhat.com>
To: qemu-block@nongnu.org, qemu-devel@nongnu.org
Cc: Fam Zheng <famz@redhat.com>, John Snow <jsnow@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Max Reitz <mreitz@redhat.com>, Eric Blake <eblake@redhat.com>,
Kevin Wolf <kwolf@redhat.com>,
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Subject: [Qemu-devel] [PATCH 2/5] qapi: add x-block-dirty-bitmap-enable/disable
Date: Tue, 5 Jun 2018 14:59:02 -0400 [thread overview]
Message-ID: <20180605185905.4583-3-jsnow@redhat.com> (raw)
In-Reply-To: <20180605185905.4583-1-jsnow@redhat.com>
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
[Added x- prefix. --js]
Signed-off-by: John Snow <jsnow@redhat.com>
---
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) {
+ 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) {
+ 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
+#
+# 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
+#
+# 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
next prev parent reply other threads:[~2018-06-05 18:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-05 18:59 [Qemu-devel] [PATCH 0/5] block dirty bitmaps: support libvirt API John Snow
2018-06-05 18:59 ` [Qemu-devel] [PATCH 1/5] block/dirty-bitmap: add lock to bdrv_enable/disable_dirty_bitmap John Snow
2018-06-06 13:23 ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-06-05 18:59 ` John Snow [this message]
2018-06-06 13:21 ` [Qemu-devel] [Qemu-block] [PATCH 2/5] qapi: add x-block-dirty-bitmap-enable/disable Jeff Cody
2018-06-06 17:46 ` [Qemu-devel] " John Snow
2018-06-05 18:59 ` [Qemu-devel] [PATCH 3/5] qmp: transaction support for x-block-dirty-bitmap-enable/disable John Snow
2018-06-05 18:59 ` [Qemu-devel] [PATCH 4/5] qapi: add x-block-dirty-bitmap-merge John Snow
2018-06-05 21:13 ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-06-05 21:56 ` John Snow
2018-06-05 18:59 ` [Qemu-devel] [PATCH 5/5] qapi: add disabled parameter to block-dirty-bitmap-add John Snow
2018-06-06 13:19 ` [Qemu-devel] [Qemu-block] " Jeff Cody
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180605185905.4583-3-jsnow@redhat.com \
--to=jsnow@redhat.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).