[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH 22/24] block/dirty-bitmap: deep release dirty bitmap
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[Qemu-block] [PATCH 22/24] block/dirty-bitmap: deep release dirty bitmaps |
Date: |
Mon, 23 Jan 2017 15:10:34 +0300 |
Remove persistent bitmap from its storage on bdrv_release_dirty_bitmap.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
---
block/dirty-bitmap.c | 21 ++++++++++++++++++---
include/block/block_int.h | 3 +++
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
index 775181c9ab..0977df6309 100644
--- a/block/dirty-bitmap.c
+++ b/block/dirty-bitmap.c
@@ -297,7 +297,8 @@ void bdrv_dirty_bitmap_truncate(BlockDriverState *bs)
static void bdrv_do_release_matching_dirty_bitmap(BlockDriverState *bs,
BdrvDirtyBitmap *bitmap,
- bool only_named)
+ bool only_named,
+ bool deep)
{
BdrvDirtyBitmap *bm, *next;
QLIST_FOREACH_SAFE(bm, &bs->dirty_bitmaps, list, next) {
@@ -305,6 +306,19 @@ static void
bdrv_do_release_matching_dirty_bitmap(BlockDriverState *bs,
assert(!bm->active_iterators);
assert(!bdrv_dirty_bitmap_frozen(bm));
assert(!bm->meta);
+
+ if (deep && bm->persistent && bs->drv &&
+ bs->drv->bdrv_remove_persistent_dirty_bitmap)
+ {
+ Error *local_err = NULL;
+ bs->drv->bdrv_remove_persistent_dirty_bitmap(bs, bm->name,
+ &local_err);
+ if (local_err != NULL) {
+ error_report_err(local_err);
+ }
+ }
+
+
QLIST_REMOVE(bm, list);
hbitmap_free(bm->bitmap);
g_free(bm->name);
@@ -322,16 +336,17 @@ static void
bdrv_do_release_matching_dirty_bitmap(BlockDriverState *bs,
void bdrv_release_dirty_bitmap(BlockDriverState *bs, BdrvDirtyBitmap *bitmap)
{
- bdrv_do_release_matching_dirty_bitmap(bs, bitmap, false);
+ bdrv_do_release_matching_dirty_bitmap(bs, bitmap, false, true);
}
/**
* Release all named dirty bitmaps attached to a BDS (for use in bdrv_close()).
* There must not be any frozen bitmaps attached.
+ * This function do not remove persistent bitmaps from the storage.
*/
void bdrv_release_named_dirty_bitmaps(BlockDriverState *bs)
{
- bdrv_do_release_matching_dirty_bitmap(bs, NULL, true);
+ bdrv_do_release_matching_dirty_bitmap(bs, NULL, true, false);
}
void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap *bitmap)
diff --git a/include/block/block_int.h b/include/block/block_int.h
index b38b3aa198..3e080d6d68 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -326,6 +326,9 @@ struct BlockDriver {
Error **errp);
bool (*bdrv_can_store_new_dirty_bitmap)(BlockDriverState *bs, const char
*name,
uint32_t granularity, Error
**errp);
+ void (*bdrv_remove_persistent_dirty_bitmap)(BlockDriverState *bs,
+ const char *name,
+ Error **errp);
QLIST_ENTRY(BlockDriver) list;
};
--
2.11.0
- [Qemu-block] [PATCH v11 00/24] qcow2: persistent dirty bitmaps, Vladimir Sementsov-Ogievskiy, 2017/01/23
- [Qemu-block] [PATCH 04/24] tests: add hbitmap iter test, Vladimir Sementsov-Ogievskiy, 2017/01/23
- [Qemu-block] [PATCH 08/24] block: introduce auto-loading bitmaps, Vladimir Sementsov-Ogievskiy, 2017/01/23
- [Qemu-block] [PATCH 03/24] hbitmap: improve dirty iter, Vladimir Sementsov-Ogievskiy, 2017/01/23
- [Qemu-block] [PATCH 18/24] qmp: add x-debug-block-dirty-bitmap-sha256, Vladimir Sementsov-Ogievskiy, 2017/01/23
- [Qemu-block] [PATCH 01/24] specs/qcow2: fix bitmap granularity qemu-specific note, Vladimir Sementsov-Ogievskiy, 2017/01/23
- [Qemu-block] [PATCH 22/24] block/dirty-bitmap: deep release dirty bitmaps,
Vladimir Sementsov-Ogievskiy <=
[Qemu-block] [PATCH 13/24] qcow2: add .bdrv_store_persistent_dirty_bitmaps(), Vladimir Sementsov-Ogievskiy, 2017/01/23
[Qemu-block] [PATCH 10/24] block/dirty-bitmap: add autoload field to BdrvDirtyBitmap, Vladimir Sementsov-Ogievskiy, 2017/01/23
[Qemu-block] [PATCH 24/24] qcow2-bitmap: cache bitmap list in BDRVQcow2State, Vladimir Sementsov-Ogievskiy, 2017/01/23
[Qemu-block] [PATCH 05/24] block: fix bdrv_dirty_bitmap_granularity signature, Vladimir Sementsov-Ogievskiy, 2017/01/23