[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v3 01/10] qapi: Add transaction support to block
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-block] [PATCH v3 01/10] qapi: Add transaction support to block-dirty-bitmap operations |
Date: |
Thu, 7 May 2015 15:54:40 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Wed, Apr 22, 2015 at 08:04:44PM -0400, John Snow wrote:
> +static void block_dirty_bitmap_clear_prepare(BlkTransactionState *common,
> + Error **errp)
> +{
> + BlockDirtyBitmapState *state = DO_UPCAST(BlockDirtyBitmapState,
> + common, common);
> + BlockDirtyBitmap *action;
> +
> + action = common->action->block_dirty_bitmap_clear;
> + state->bitmap = block_dirty_bitmap_lookup(action->node,
> + action->name,
> + &state->bs,
> + &state->aio_context,
> + errp);
> + if (!state->bitmap) {
> + return;
> + }
> +
> + if (bdrv_dirty_bitmap_frozen(state->bitmap)) {
> + error_setg(errp, "Cannot modify a frozen bitmap");
> + return;
> + } else if (!bdrv_dirty_bitmap_enabled(state->bitmap)) {
> + error_setg(errp, "Cannot clear a disabled bitmap");
> + return;
> + }
> +
> + /* AioContext is released in .clean() */
> +}
> +
> +static void block_dirty_bitmap_clear_commit(BlkTransactionState *common)
> +{
> + BlockDirtyBitmapState *state = DO_UPCAST(BlockDirtyBitmapState,
> + common, common);
> + bdrv_clear_dirty_bitmap(state->bitmap);
> +}
These semantics don't work in this example:
[block-dirty-bitmap-clear,
drive-backup]
Since drive-backup starts the blockjob in .prepare() but
block-dirty-bitmap-clear only clears the bitmap in .commit() the order
is wrong.
.prepare() has to do something non-destructive, like stashing away the
HBitmap and replacing it with an empty one. Then .commit() can discard
the old bitmap while .abort() can move the old bitmap back to undo the
operation.
Stefan
pgpqpNY03dZfr.pgp
Description: PGP signature
- Re: [Qemu-block] [PATCH v3 01/10] qapi: Add transaction support to block-dirty-bitmap operations,
Stefan Hajnoczi <=