From: Max Reitz <mreitz@redhat.com>
To: John Snow <jsnow@redhat.com>, Fam Zheng <famz@redhat.com>,
qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Benoit Canet <benoit@irqsave.net>,
Markus Armbruster <armbru@redhat.com>,
Luiz Capitulino <lcapitulino@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Jd <jd_jedi@convirture.com>, Paolo Bonzini <pbonzini@redhat.com>,
Vladimir Sementsov-Ogievskij <etendren@gmail.com>
Subject: Re: [Qemu-devel] [PATCH v6 08/10] qapi: Add transaction support to block-dirty-bitmap-{add, enable, disable}
Date: Mon, 24 Nov 2014 09:35:48 +0100 [thread overview]
Message-ID: <5472EDE4.6050509@redhat.com> (raw)
In-Reply-To: <546FBB93.7000809@redhat.com>
On 2014-11-21 at 23:24, John Snow wrote:
>
>
> On 11/04/2014 06:03 AM, Max Reitz wrote:
>> On 2014-10-30 at 04:22, Fam Zheng wrote:
>>> This adds three qmp commands to transactions.
>>>
>>> Users can stop a dirty bitmap, start backup of it, and start another
>>> dirty bitmap atomically, so that the dirty bitmap is tracked
>>> incrementally and we don't miss any write.
>>>
>>> Signed-off-by: Fam Zheng <famz@redhat.com>
>>> ---
>>> blockdev.c | 92
>>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>> qapi-schema.json | 5 ++-
>>> 2 files changed, 96 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/blockdev.c b/blockdev.c
>>> index fca909b..34fa314 100644
>>> --- a/blockdev.c
>>> +++ b/blockdev.c
>>> @@ -1490,6 +1490,83 @@ static void
>>> drive_backup_abort(BlkTransactionState *common)
>>> }
>>> }
>>> +static void block_dirty_bitmap_add_prepare(BlkTransactionState
>>> *common,
>>> + Error **errp)
>>> +{
>>> + BlockDirtyBitmapAdd *action;
>>> +
>>> + action = common->action->block_dirty_bitmap_add;
>>> + qmp_block_dirty_bitmap_add(action->device, action->name,
>>> + action->has_granularity,
>>> action->granularity,
>>> + errp);
>>> +}
>>> +
>>> +static void block_dirty_bitmap_add_abort(BlkTransactionState *common)
>>> +{
>>> + BlockDirtyBitmapAdd *action;
>>> + BdrvDirtyBitmap *bm;
>>> + BlockDriverState *bs;
>>> +
>>> + action = common->action->block_dirty_bitmap_add;
>>> + bs = bdrv_find(action->device);
>>> + if (bs) {
>>> + bm = bdrv_find_dirty_bitmap(bs, action->name);
>>> + if (bm) {
>>> + bdrv_release_dirty_bitmap(bs, bm);
>>> + }
>>> + }
>>> +}
>>> +
>>> +static void block_dirty_bitmap_enable_prepare(BlkTransactionState
>>> *common,
>>> + Error **errp)
>>> +{
>>> + BlockDirtyBitmap *action;
>>> +
>>> + action = common->action->block_dirty_bitmap_enable;
>>> + qmp_block_dirty_bitmap_enable(action->device, action->name, errp);
>>> +}
>>> +
>>> +static void block_dirty_bitmap_enable_abort(BlkTransactionState
>>> *common)
>>> +{
>>> + BlockDirtyBitmap *action;
>>> + BdrvDirtyBitmap *bitmap;
>>> + BlockDriverState *bs;
>>> +
>>> + action = common->action->block_dirty_bitmap_enable;
>>> + bs = bdrv_find(action->device);
>>> + if (bs) {
>>> + bitmap = bdrv_find_dirty_bitmap(bs, action->name);
>>> + if (bitmap) {
>>> + bdrv_disable_dirty_bitmap(bs, bitmap);
>>
>> But what if the dirty bitmap was enabled before so that this enabling
>> transaction was supposed to be a no-op?
>
> Maybe it's not a problem: The only case in which the enable/disable
> operation will fail is if it cannot find the device or bitmap -- in
> which case, the abort operation isn't going to be able to affect
> anything either.
Well, it's part of a transaction. As far as I understand it, one groups
several operations in one transaction and if any fails, all are aborted.
Therefore, the "enable the dirty bitmap" operation can trivially succeed
(because it was enabled before), but some different operation may fail,
which then results in invocation of this abort function.
Max
> Unless you know something I don't.
>
> Still, it does look goofy. Thoughts?
next prev parent reply other threads:[~2014-11-24 8:36 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-30 3:22 [Qemu-devel] [PATCH v6 00/10] block: Incremental backup series Fam Zheng
2014-10-30 3:22 ` [Qemu-devel] [PATCH v6 01/10] qapi: Add optional field "name" to block dirty bitmap Fam Zheng
2014-11-04 9:08 ` Max Reitz
2014-11-07 12:48 ` Eric Blake
2014-10-30 3:22 ` [Qemu-devel] [PATCH v6 02/10] qmp: Add block-dirty-bitmap-add and block-dirty-bitmap-remove Fam Zheng
2014-11-04 9:26 ` Max Reitz
2014-11-07 13:00 ` Eric Blake
2014-11-18 16:44 ` [Qemu-devel] qmp-commands.hx and inherited types (Was: Re: [PATCH v6 02/10] qmp: Add block-dirty-bitmap-add and block-dirty-bitmap-remove) John Snow
2014-11-18 17:00 ` Eric Blake
2014-10-30 3:22 ` [Qemu-devel] [PATCH v6 03/10] block: Introduce bdrv_dirty_bitmap_granularity() Fam Zheng
2014-11-04 9:44 ` Max Reitz
2014-10-30 3:22 ` [Qemu-devel] [PATCH v6 04/10] hbitmap: Add hbitmap_copy Fam Zheng
2014-11-04 9:58 ` Max Reitz
2014-10-30 3:22 ` [Qemu-devel] [PATCH v6 05/10] block: Add bdrv_copy_dirty_bitmap and bdrv_reset_dirty_bitmap Fam Zheng
2014-11-04 10:08 ` Max Reitz
2014-10-30 3:22 ` [Qemu-devel] [PATCH v6 06/10] qmp: Add block-dirty-bitmap-enable and block-dirty-bitmap-disable Fam Zheng
2014-11-04 10:17 ` Max Reitz
2014-10-30 3:22 ` [Qemu-devel] [PATCH v6 07/10] qmp: Add support of "dirty-bitmap" sync mode for drive-backup Fam Zheng
2014-11-04 10:53 ` Max Reitz
2014-10-30 3:22 ` [Qemu-devel] [PATCH v6 08/10] qapi: Add transaction support to block-dirty-bitmap-{add, enable, disable} Fam Zheng
2014-11-04 11:03 ` Max Reitz
2014-11-21 22:24 ` John Snow
2014-11-24 8:35 ` Max Reitz [this message]
2014-11-24 9:41 ` Paolo Bonzini
2014-11-24 9:46 ` Max Reitz
2014-11-24 9:54 ` Paolo Bonzini
2014-10-30 3:22 ` [Qemu-devel] [PATCH v6 09/10] qmp: Add dirty bitmap 'enabled' field in query-block Fam Zheng
2014-11-04 11:05 ` Max Reitz
2014-10-30 3:22 ` [Qemu-devel] [PATCH v6 10/10] qemu-iotests: Add tests for drive-backup sync=dirty-bitmap Fam Zheng
2014-11-04 11:10 ` Max Reitz
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=5472EDE4.6050509@redhat.com \
--to=mreitz@redhat.com \
--cc=armbru@redhat.com \
--cc=benoit@irqsave.net \
--cc=etendren@gmail.com \
--cc=famz@redhat.com \
--cc=jd_jedi@convirture.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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).