[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 089/100] block/dirty-bitmap: add bdrv_remove_persiste
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 089/100] block/dirty-bitmap: add bdrv_remove_persistent_dirty_bitmap |
Date: |
Fri, 7 Jul 2017 19:08:44 +0200 |
From: Vladimir Sementsov-Ogievskiy <address@hidden>
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>
Message-id: address@hidden
Signed-off-by: Max Reitz <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 5fcf917..b2ca78b 100644
--- a/block/dirty-bitmap.c
+++ b/block/dirty-bitmap.c
@@ -395,6 +395,7 @@ 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.
* Called with BQL taken.
*/
void bdrv_release_named_dirty_bitmaps(BlockDriverState *bs)
@@ -402,6 +403,23 @@ 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);
+ }
+}
+
/* Called with BQL taken. */
void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap *bitmap)
{
diff --git a/include/block/block_int.h b/include/block/block_int.h
index c9e29bf..58d4ffd 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -391,6 +391,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 8e98aef..93d97f0 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);
--
1.8.3.1
- [Qemu-block] [PULL 079/100] block: introduce persistent dirty bitmaps, (continued)
- [Qemu-block] [PULL 079/100] block: introduce persistent dirty bitmaps, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 082/100] qcow2: store bitmaps on reopening image as read-only, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 080/100] block/dirty-bitmap: add bdrv_dirty_bitmap_next(), Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 081/100] qcow2: add persistent dirty bitmaps support, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 083/100] block: add bdrv_can_store_new_dirty_bitmap, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 087/100] qmp: add x-debug-block-dirty-bitmap-sha256, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 084/100] qcow2: add .bdrv_can_store_new_dirty_bitmap, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 086/100] qmp: add autoload parameter to block-dirty-bitmap-add, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 088/100] iotests: test qcow2 persistent dirty bitmap, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 085/100] qmp: add persistent flag to block-dirty-bitmap-add, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 089/100] block/dirty-bitmap: add bdrv_remove_persistent_dirty_bitmap,
Kevin Wolf <=
- [Qemu-block] [PULL 093/100] iotests: skip 159 & 170 with luks format, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 091/100] qmp: block-dirty-bitmap-remove: remove persistent, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 092/100] block: release persistent bitmaps on inactivate, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 090/100] qcow2: add .bdrv_remove_persistent_dirty_bitmap, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 094/100] iotests: fix remainining tests to work with LUKS, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 095/100] iotests: reduce PBKDF iterations when testing LUKS, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 096/100] iotests: add more LUKS hash combination tests, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 098/100] iotests: Use absolute paths for executables, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 100/100] tests: Avoid non-portable 'echo -ARG', Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 099/100] iotests: Add test for colon handling, Kevin Wolf, 2017/07/07