diff options
-rw-r--r-- | blockdev.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/blockdev.c b/blockdev.c index a2ebaa5afc..4bf15566b2 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1979,7 +1979,6 @@ typedef struct BlockDirtyBitmapState { BdrvDirtyBitmap *bitmap; BlockDriverState *bs; HBitmap *backup; - bool prepared; bool was_enabled; } BlockDirtyBitmapState; @@ -2008,7 +2007,8 @@ static void block_dirty_bitmap_add_action(BlkActionState *common, &local_err); if (!local_err) { - state->prepared = true; + state->bitmap = block_dirty_bitmap_lookup(action->node, action->name, + NULL, &error_abort); } else { error_propagate(errp, local_err); } @@ -2016,15 +2016,10 @@ static void block_dirty_bitmap_add_action(BlkActionState *common, static void block_dirty_bitmap_add_abort(void *opaque) { - BlockDirtyBitmapAdd *action; BlockDirtyBitmapState *state = opaque; - action = state->common.action->u.block_dirty_bitmap_add.data; - /* Should not be able to fail: IF the bitmap was added via .prepare(), - * then the node reference and bitmap name must have been valid. - */ - if (state->prepared) { - qmp_block_dirty_bitmap_remove(action->node, action->name, &error_abort); + if (state->bitmap) { + bdrv_release_dirty_bitmap(state->bitmap); } } |