[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v20 27/30] block/dirty-bitmap: add bdrv_remove_persi
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[Qemu-block] [PATCH v20 27/30] block/dirty-bitmap: add bdrv_remove_persistent_dirty_bitmap |
Date: |
Fri, 2 Jun 2017 14:21:55 +0300 |
Interface for removing persistent bitmap from its storage.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Reviewed-by: John Snow <address@hidden>
---
block/dirty-bitmap.c | 18 ++++++++++++++++++
include/block/block_int.h | 3 +++
include/block/dirty-bitmap.h | 3 +++
3 files changed, 24 insertions(+)
diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
index 2ae64fc9e8..6b43ad04fc 100644
--- a/block/dirty-bitmap.c
+++ b/block/dirty-bitmap.c
@@ -334,12 +334,30 @@ void bdrv_release_dirty_bitmap(BlockDriverState *bs,
BdrvDirtyBitmap *bitmap)
/**
* Release all named dirty bitmaps attached to a BDS (for use in bdrv_close()).
* There must not be any frozen bitmaps attached.
+ * This function does not remove persistent bitmaps from the storage.
*/
void bdrv_release_named_dirty_bitmaps(BlockDriverState *bs)
{
bdrv_do_release_matching_dirty_bitmap(bs, NULL, true);
}
+/**
+ * Remove persistent dirty bitmap from the storage if it exists.
+ * Absence of bitmap is not an error, because we have the following scenario:
+ * BdrvDirtyBitmap can have .persistent = true but not yet saved and have no
+ * stored version. For such bitmap bdrv_remove_persistent_dirty_bitmap() should
+ * not fail.
+ * This function doesn't release corresponding BdrvDirtyBitmap.
+ */
+void bdrv_remove_persistent_dirty_bitmap(BlockDriverState *bs,
+ const char *name,
+ Error **errp)
+{
+ if (bs->drv && bs->drv->bdrv_remove_persistent_dirty_bitmap) {
+ bs->drv->bdrv_remove_persistent_dirty_bitmap(bs, name, errp);
+ }
+}
+
void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap *bitmap)
{
assert(!bdrv_dirty_bitmap_frozen(bitmap));
diff --git a/include/block/block_int.h b/include/block/block_int.h
index adda0894c7..953107f095 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -390,6 +390,9 @@ struct BlockDriver {
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;
};
diff --git a/include/block/dirty-bitmap.h b/include/block/dirty-bitmap.h
index 00b298330c..5fac2d8411 100644
--- a/include/block/dirty-bitmap.h
+++ b/include/block/dirty-bitmap.h
@@ -25,6 +25,9 @@ BdrvDirtyBitmap *bdrv_find_dirty_bitmap(BlockDriverState *bs,
void bdrv_dirty_bitmap_make_anon(BdrvDirtyBitmap *bitmap);
void bdrv_release_dirty_bitmap(BlockDriverState *bs, BdrvDirtyBitmap *bitmap);
void bdrv_release_named_dirty_bitmaps(BlockDriverState *bs);
+void bdrv_remove_persistent_dirty_bitmap(BlockDriverState *bs,
+ const char *name,
+ Error **errp);
void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap *bitmap);
void bdrv_enable_dirty_bitmap(BdrvDirtyBitmap *bitmap);
BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs);
--
2.11.1
- [Qemu-block] [PATCH v20 06/30] block/dirty-bitmap: add deserialize_ones func, (continued)
- [Qemu-block] [PATCH v20 06/30] block/dirty-bitmap: add deserialize_ones func, Vladimir Sementsov-Ogievskiy, 2017/06/02
- [Qemu-block] [PATCH v20 05/30] block: fix bdrv_dirty_bitmap_granularity signature, Vladimir Sementsov-Ogievskiy, 2017/06/02
- [Qemu-block] [PATCH v20 12/30] block: refactor bdrv_reopen_commit, Vladimir Sementsov-Ogievskiy, 2017/06/02
- [Qemu-block] [PATCH v20 16/30] block: bdrv_close: release bitmaps after drv->bdrv_close, Vladimir Sementsov-Ogievskiy, 2017/06/02
- [Qemu-block] [PATCH v20 18/30] block/dirty-bitmap: add bdrv_dirty_bitmap_next(), Vladimir Sementsov-Ogievskiy, 2017/06/02
- [Qemu-block] [PATCH v20 28/30] qcow2: add .bdrv_remove_persistent_dirty_bitmap, Vladimir Sementsov-Ogievskiy, 2017/06/02
- [Qemu-block] [PATCH v20 29/30] qmp: block-dirty-bitmap-remove: remove persistent, Vladimir Sementsov-Ogievskiy, 2017/06/02
- [Qemu-block] [PATCH v20 07/30] qcow2-refcount: rename inc_refcounts() and make it public, Vladimir Sementsov-Ogievskiy, 2017/06/02
- [Qemu-block] [PATCH v20 21/30] block: add bdrv_can_store_new_dirty_bitmap, Vladimir Sementsov-Ogievskiy, 2017/06/02
- [Qemu-block] [PATCH v20 27/30] block/dirty-bitmap: add bdrv_remove_persistent_dirty_bitmap,
Vladimir Sementsov-Ogievskiy <=
- [Qemu-block] [PATCH v20 22/30] qcow2: add .bdrv_can_store_new_dirty_bitmap, Vladimir Sementsov-Ogievskiy, 2017/06/02
- [Qemu-block] [PATCH v20 02/30] specs/qcow2: do not use wording 'bitmap header', Vladimir Sementsov-Ogievskiy, 2017/06/02
- [Qemu-block] [PATCH v20 10/30] block/dirty-bitmap: add readonly field to BdrvDirtyBitmap, Vladimir Sementsov-Ogievskiy, 2017/06/02
- [Qemu-block] [PATCH v20 08/30] qcow2: add bitmaps extension, Vladimir Sementsov-Ogievskiy, 2017/06/02
- [Qemu-block] [PATCH v20 17/30] block: introduce persistent dirty bitmaps, Vladimir Sementsov-Ogievskiy, 2017/06/02
- [Qemu-block] [PATCH v20 30/30] block: release persistent bitmaps on inactivate, Vladimir Sementsov-Ogievskiy, 2017/06/02