[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v21 15/30] block/dirty-bitmap: add autoload field to
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[Qemu-block] [PATCH v21 15/30] block/dirty-bitmap: add autoload field to BdrvDirtyBitmap |
Date: |
Tue, 13 Jun 2017 17:03:43 +0300 |
Mirror AUTO flag from Qcow2 bitmap in BdrvDirtyBitmap. This will be
needed in future, to save this flag back to Qcow2 for persistent
bitmaps.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Reviewed-by: John Snow <address@hidden>
---
block/dirty-bitmap.c | 15 +++++++++++++++
block/qcow2-bitmap.c | 2 ++
include/block/dirty-bitmap.h | 3 +++
3 files changed, 20 insertions(+)
diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
index e18166c968..da7d1ec867 100644
--- a/block/dirty-bitmap.c
+++ b/block/dirty-bitmap.c
@@ -51,6 +51,8 @@ struct BdrvDirtyBitmap {
Such operations must fail and both the image
and this bitmap must remain unchanged while
this flag is set. */
+ bool autoload; /* For persistent bitmaps: bitmap must be
+ autoloaded on image opening */
QLIST_ENTRY(BdrvDirtyBitmap) list;
};
@@ -77,6 +79,7 @@ void bdrv_dirty_bitmap_make_anon(BdrvDirtyBitmap *bitmap)
assert(!bdrv_dirty_bitmap_frozen(bitmap));
g_free(bitmap->name);
bitmap->name = NULL;
+ bitmap->autoload = false;
}
BdrvDirtyBitmap *bdrv_create_dirty_bitmap(BlockDriverState *bs,
@@ -245,6 +248,8 @@ BdrvDirtyBitmap
*bdrv_dirty_bitmap_abdicate(BlockDriverState *bs,
bitmap->name = NULL;
successor->name = name;
bitmap->successor = NULL;
+ successor->autoload = bitmap->autoload;
+ bitmap->autoload = false;
bdrv_release_dirty_bitmap(bs, bitmap);
return successor;
@@ -573,3 +578,13 @@ bool bdrv_has_readonly_bitmaps(BlockDriverState *bs)
return false;
}
+
+void bdrv_dirty_bitmap_set_autoload(BdrvDirtyBitmap *bitmap, bool autoload)
+{
+ bitmap->autoload = autoload;
+}
+
+bool bdrv_dirty_bitmap_get_autoload(const BdrvDirtyBitmap *bitmap)
+{
+ return bitmap->autoload;
+}
diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c
index a21fab8ce8..ee6d8f75a9 100644
--- a/block/qcow2-bitmap.c
+++ b/block/qcow2-bitmap.c
@@ -793,6 +793,8 @@ bool qcow2_load_autoloading_dirty_bitmaps(BlockDriverState
*bs, Error **errp)
if (bitmap == NULL) {
goto fail;
}
+
+ bdrv_dirty_bitmap_set_autoload(bitmap, true);
bm->flags |= BME_FLAG_IN_USE;
created_dirty_bitmaps =
g_slist_append(created_dirty_bitmaps, bitmap);
diff --git a/include/block/dirty-bitmap.h b/include/block/dirty-bitmap.h
index aa6d47ee00..9416f9233f 100644
--- a/include/block/dirty-bitmap.h
+++ b/include/block/dirty-bitmap.h
@@ -79,4 +79,7 @@ bool bdrv_dirty_bitmap_readonly(const BdrvDirtyBitmap
*bitmap);
void bdrv_dirty_bitmap_set_readonly(BdrvDirtyBitmap *bitmap, bool value);
bool bdrv_has_readonly_bitmaps(BlockDriverState *bs);
+void bdrv_dirty_bitmap_set_autoload(BdrvDirtyBitmap *bitmap, bool autoload);
+bool bdrv_dirty_bitmap_get_autoload(const BdrvDirtyBitmap *bitmap);
+
#endif
--
2.11.1
- [Qemu-block] [PATCH v21 11/30] qcow2: autoloading dirty bitmaps, (continued)
- [Qemu-block] [PATCH v21 11/30] qcow2: autoloading dirty bitmaps, Vladimir Sementsov-Ogievskiy, 2017/06/13
- [Qemu-block] [PATCH v21 24/30] qmp: add autoload parameter to block-dirty-bitmap-add, Vladimir Sementsov-Ogievskiy, 2017/06/13
- [Qemu-block] [PATCH v21 04/30] tests: add hbitmap iter test, Vladimir Sementsov-Ogievskiy, 2017/06/13
- [Qemu-block] [PATCH v21 17/30] block: introduce persistent dirty bitmaps, Vladimir Sementsov-Ogievskiy, 2017/06/13
- [Qemu-block] [PATCH v21 18/30] block/dirty-bitmap: add bdrv_dirty_bitmap_next(), Vladimir Sementsov-Ogievskiy, 2017/06/13
- [Qemu-block] [PATCH v21 08/30] qcow2: add bitmaps extension, Vladimir Sementsov-Ogievskiy, 2017/06/13
- [Qemu-block] [PATCH v21 25/30] qmp: add x-debug-block-dirty-bitmap-sha256, Vladimir Sementsov-Ogievskiy, 2017/06/13
- [Qemu-block] [PATCH v21 30/30] block: release persistent bitmaps on inactivate, Vladimir Sementsov-Ogievskiy, 2017/06/13
- [Qemu-block] [PATCH v21 09/30] block/dirty-bitmap: fix comment for BlockDirtyBitmap.disabled field, Vladimir Sementsov-Ogievskiy, 2017/06/13
- [Qemu-block] [PATCH v21 27/30] block/dirty-bitmap: add bdrv_remove_persistent_dirty_bitmap, Vladimir Sementsov-Ogievskiy, 2017/06/13
- [Qemu-block] [PATCH v21 15/30] block/dirty-bitmap: add autoload field to BdrvDirtyBitmap,
Vladimir Sementsov-Ogievskiy <=
- [Qemu-block] [PATCH v21 20/30] qcow2: store bitmaps on reopening image as read-only, Vladimir Sementsov-Ogievskiy, 2017/06/13
- [Qemu-block] [PATCH v21 02/30] specs/qcow2: do not use wording 'bitmap header', Vladimir Sementsov-Ogievskiy, 2017/06/13
- [Qemu-block] [PATCH v21 10/30] block/dirty-bitmap: add readonly field to BdrvDirtyBitmap, Vladimir Sementsov-Ogievskiy, 2017/06/13
- [Qemu-block] [PATCH v21 19/30] qcow2: add persistent dirty bitmaps support, Vladimir Sementsov-Ogievskiy, 2017/06/13
- Re: [Qemu-block] [Qemu-devel] [PATCH v21 00/30] qcow2: persistent dirty bitmaps, no-reply, 2017/06/13
- Re: [Qemu-block] [PATCH v21 00/30] qcow2: persistent dirty bitmaps, Max Reitz, 2017/06/14
- Re: [Qemu-block] [PATCH v21 00/30] qcow2: persistent dirty bitmaps, Max Reitz, 2017/06/26