[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH 5/7] blockdev: refactor block-dirty-bitmap-clear tra
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[Qemu-block] [PATCH 5/7] blockdev: refactor block-dirty-bitmap-clear transaction |
Date: |
Mon, 26 Mar 2018 14:20:54 +0300 |
bdrv_clear_dirty_bitmap do not fail, so we can call it in transaction
commit, avoiding any rollback.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
---
blockdev.c | 16 +---------------
1 file changed, 1 insertion(+), 15 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index c31bf3d98d..88eae60c1c 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2050,7 +2050,6 @@ typedef struct BlockDirtyBitmapState {
BlkActionState common;
BdrvDirtyBitmap *bitmap;
BlockDriverState *bs;
- HBitmap *backup;
bool prepared;
} BlockDirtyBitmapState;
@@ -2129,18 +2128,6 @@ static void
block_dirty_bitmap_clear_prepare(BlkActionState *common,
error_setg(errp, "Cannot clear a readonly bitmap");
return;
}
-
- bdrv_clear_dirty_bitmap(state->bitmap, &state->backup);
-}
-
-static void block_dirty_bitmap_clear_abort(BlkActionState *common)
-{
- BlockDirtyBitmapState *state = DO_UPCAST(BlockDirtyBitmapState,
- common, common);
-
- if (state->backup) {
- bdrv_undo_clear_dirty_bitmap(state->bitmap, state->backup);
- }
}
static void block_dirty_bitmap_clear_commit(BlkActionState *common)
@@ -2148,7 +2135,7 @@ static void
block_dirty_bitmap_clear_commit(BlkActionState *common)
BlockDirtyBitmapState *state = DO_UPCAST(BlockDirtyBitmapState,
common, common);
- hbitmap_free(state->backup);
+ bdrv_clear_dirty_bitmap(state->bitmap, NULL);
}
static void abort_prepare(BlkActionState *common, Error **errp)
@@ -2210,7 +2197,6 @@ static const BlkActionOps actions[] = {
.instance_size = sizeof(BlockDirtyBitmapState),
.prepare = block_dirty_bitmap_clear_prepare,
.commit = block_dirty_bitmap_clear_commit,
- .abort = block_dirty_bitmap_clear_abort,
}
};
--
2.11.1
- [Qemu-block] [PATCH 0/7] Dirty bitmaps fixing and refactoring, Vladimir Sementsov-Ogievskiy, 2018/03/26
- [Qemu-block] [PATCH 5/7] blockdev: refactor block-dirty-bitmap-clear transaction,
Vladimir Sementsov-Ogievskiy <=
- [Qemu-block] [PATCH 7/7] blockdev: unify block-dirty-bitmap-clear command and transaction action, Vladimir Sementsov-Ogievskiy, 2018/03/26
- [Qemu-block] [PATCH 1/7] block/dirty-bitmap: add lock to bdrv_enable/disable_dirty_bitmap, Vladimir Sementsov-Ogievskiy, 2018/03/26
- [Qemu-block] [PATCH 3/7] dirty-bitmap: remove missed bdrv_dirty_bitmap_get_autoload header, Vladimir Sementsov-Ogievskiy, 2018/03/26
- [Qemu-block] [PATCH 4/7] dirty-bitmap: separate unused meta-bitmap related functions, Vladimir Sementsov-Ogievskiy, 2018/03/26
- [Qemu-block] [PATCH 6/7] block/dirty-bitmap: bdrv_clear_dirty_bitmap: drop unused parameter, Vladimir Sementsov-Ogievskiy, 2018/03/26
- [Qemu-block] [PATCH 2/7] dirty-bitmaps: fix comment about dirty_bitmap_mutex, Vladimir Sementsov-Ogievskiy, 2018/03/26
- Re: [Qemu-block] [Qemu-devel] [PATCH 0/7] Dirty bitmaps fixing and refactoring, Paolo Bonzini, 2018/03/26