2016-03-08 05:44:55 +01:00
|
|
|
#ifndef BLOCK_DIRTY_BITMAP_H
|
|
|
|
#define BLOCK_DIRTY_BITMAP_H
|
|
|
|
|
|
|
|
#include "qemu-common.h"
|
2018-02-11 10:36:01 +01:00
|
|
|
#include "qapi/qapi-types-block-core.h"
|
2016-03-08 05:44:55 +01:00
|
|
|
#include "qemu/hbitmap.h"
|
|
|
|
|
|
|
|
BdrvDirtyBitmap *bdrv_create_dirty_bitmap(BlockDriverState *bs,
|
|
|
|
uint32_t granularity,
|
|
|
|
const char *name,
|
|
|
|
Error **errp);
|
2016-10-13 23:58:24 +02:00
|
|
|
void bdrv_create_meta_dirty_bitmap(BdrvDirtyBitmap *bitmap,
|
|
|
|
int chunk_size);
|
|
|
|
void bdrv_release_meta_dirty_bitmap(BdrvDirtyBitmap *bitmap);
|
2016-03-08 05:44:55 +01:00
|
|
|
int bdrv_dirty_bitmap_create_successor(BlockDriverState *bs,
|
|
|
|
BdrvDirtyBitmap *bitmap,
|
|
|
|
Error **errp);
|
|
|
|
BdrvDirtyBitmap *bdrv_dirty_bitmap_abdicate(BlockDriverState *bs,
|
|
|
|
BdrvDirtyBitmap *bitmap,
|
|
|
|
Error **errp);
|
|
|
|
BdrvDirtyBitmap *bdrv_reclaim_dirty_bitmap(BlockDriverState *bs,
|
|
|
|
BdrvDirtyBitmap *bitmap,
|
|
|
|
Error **errp);
|
2018-03-13 20:33:59 +01:00
|
|
|
void bdrv_dirty_bitmap_enable_successor(BdrvDirtyBitmap *bitmap);
|
2016-03-08 05:44:55 +01:00
|
|
|
BdrvDirtyBitmap *bdrv_find_dirty_bitmap(BlockDriverState *bs,
|
|
|
|
const char *name);
|
|
|
|
void bdrv_release_dirty_bitmap(BlockDriverState *bs, BdrvDirtyBitmap *bitmap);
|
|
|
|
void bdrv_release_named_dirty_bitmaps(BlockDriverState *bs);
|
2017-06-28 14:05:30 +02:00
|
|
|
void bdrv_release_persistent_dirty_bitmaps(BlockDriverState *bs);
|
2017-06-28 14:05:27 +02:00
|
|
|
void bdrv_remove_persistent_dirty_bitmap(BlockDriverState *bs,
|
|
|
|
const char *name,
|
|
|
|
Error **errp);
|
2016-03-08 05:44:55 +01:00
|
|
|
void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap *bitmap);
|
|
|
|
void bdrv_enable_dirty_bitmap(BdrvDirtyBitmap *bitmap);
|
|
|
|
BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs);
|
|
|
|
uint32_t bdrv_get_default_bitmap_granularity(BlockDriverState *bs);
|
2017-06-28 14:05:05 +02:00
|
|
|
uint32_t bdrv_dirty_bitmap_granularity(const BdrvDirtyBitmap *bitmap);
|
2016-03-08 05:44:55 +01:00
|
|
|
bool bdrv_dirty_bitmap_enabled(BdrvDirtyBitmap *bitmap);
|
|
|
|
bool bdrv_dirty_bitmap_frozen(BdrvDirtyBitmap *bitmap);
|
2016-10-13 23:58:25 +02:00
|
|
|
const char *bdrv_dirty_bitmap_name(const BdrvDirtyBitmap *bitmap);
|
|
|
|
int64_t bdrv_dirty_bitmap_size(const BdrvDirtyBitmap *bitmap);
|
2016-03-08 05:44:55 +01:00
|
|
|
DirtyBitmapStatus bdrv_dirty_bitmap_status(BdrvDirtyBitmap *bitmap);
|
|
|
|
void bdrv_set_dirty_bitmap(BdrvDirtyBitmap *bitmap,
|
2017-09-25 16:55:20 +02:00
|
|
|
int64_t offset, int64_t bytes);
|
2016-03-08 05:44:55 +01:00
|
|
|
void bdrv_reset_dirty_bitmap(BdrvDirtyBitmap *bitmap,
|
2017-09-25 16:55:20 +02:00
|
|
|
int64_t offset, int64_t bytes);
|
2016-10-13 23:58:30 +02:00
|
|
|
BdrvDirtyBitmapIter *bdrv_dirty_meta_iter_new(BdrvDirtyBitmap *bitmap);
|
2017-09-25 16:55:16 +02:00
|
|
|
BdrvDirtyBitmapIter *bdrv_dirty_iter_new(BdrvDirtyBitmap *bitmap);
|
2016-10-13 23:58:21 +02:00
|
|
|
void bdrv_dirty_iter_free(BdrvDirtyBitmapIter *iter);
|
2016-03-08 05:44:55 +01:00
|
|
|
|
2016-10-13 23:58:28 +02:00
|
|
|
uint64_t bdrv_dirty_bitmap_serialization_size(const BdrvDirtyBitmap *bitmap,
|
2017-09-25 16:55:14 +02:00
|
|
|
uint64_t offset, uint64_t bytes);
|
2016-10-13 23:58:28 +02:00
|
|
|
uint64_t bdrv_dirty_bitmap_serialization_align(const BdrvDirtyBitmap *bitmap);
|
|
|
|
void bdrv_dirty_bitmap_serialize_part(const BdrvDirtyBitmap *bitmap,
|
2017-09-25 16:55:14 +02:00
|
|
|
uint8_t *buf, uint64_t offset,
|
|
|
|
uint64_t bytes);
|
2016-10-13 23:58:28 +02:00
|
|
|
void bdrv_dirty_bitmap_deserialize_part(BdrvDirtyBitmap *bitmap,
|
2017-09-25 16:55:14 +02:00
|
|
|
uint8_t *buf, uint64_t offset,
|
|
|
|
uint64_t bytes, bool finish);
|
2016-10-13 23:58:28 +02:00
|
|
|
void bdrv_dirty_bitmap_deserialize_zeroes(BdrvDirtyBitmap *bitmap,
|
2017-09-25 16:55:14 +02:00
|
|
|
uint64_t offset, uint64_t bytes,
|
2016-10-13 23:58:28 +02:00
|
|
|
bool finish);
|
2017-06-28 14:05:06 +02:00
|
|
|
void bdrv_dirty_bitmap_deserialize_ones(BdrvDirtyBitmap *bitmap,
|
2017-09-25 16:55:14 +02:00
|
|
|
uint64_t offset, uint64_t bytes,
|
2017-06-28 14:05:06 +02:00
|
|
|
bool finish);
|
2016-10-13 23:58:28 +02:00
|
|
|
void bdrv_dirty_bitmap_deserialize_finish(BdrvDirtyBitmap *bitmap);
|
|
|
|
|
2017-06-28 14:05:10 +02:00
|
|
|
void bdrv_dirty_bitmap_set_readonly(BdrvDirtyBitmap *bitmap, bool value);
|
2017-06-28 14:05:17 +02:00
|
|
|
void bdrv_dirty_bitmap_set_persistance(BdrvDirtyBitmap *bitmap,
|
|
|
|
bool persistent);
|
2018-03-13 20:34:00 +01:00
|
|
|
void bdrv_dirty_bitmap_set_qmp_locked(BdrvDirtyBitmap *bitmap, bool qmp_locked);
|
2018-06-11 20:53:32 +02:00
|
|
|
void bdrv_merge_dirty_bitmap(BdrvDirtyBitmap *dest, const BdrvDirtyBitmap *src,
|
|
|
|
Error **errp);
|
2017-06-28 14:05:10 +02:00
|
|
|
|
2017-06-05 14:39:05 +02:00
|
|
|
/* Functions that require manual locking. */
|
|
|
|
void bdrv_dirty_bitmap_lock(BdrvDirtyBitmap *bitmap);
|
|
|
|
void bdrv_dirty_bitmap_unlock(BdrvDirtyBitmap *bitmap);
|
2017-09-25 16:55:19 +02:00
|
|
|
bool bdrv_get_dirty_locked(BlockDriverState *bs, BdrvDirtyBitmap *bitmap,
|
|
|
|
int64_t offset);
|
2017-06-05 14:39:05 +02:00
|
|
|
void bdrv_set_dirty_bitmap_locked(BdrvDirtyBitmap *bitmap,
|
2017-09-25 16:55:20 +02:00
|
|
|
int64_t offset, int64_t bytes);
|
2017-06-05 14:39:05 +02:00
|
|
|
void bdrv_reset_dirty_bitmap_locked(BdrvDirtyBitmap *bitmap,
|
2017-09-25 16:55:20 +02:00
|
|
|
int64_t offset, int64_t bytes);
|
2017-06-05 14:39:05 +02:00
|
|
|
int64_t bdrv_dirty_iter_next(BdrvDirtyBitmapIter *iter);
|
2018-06-13 20:18:18 +02:00
|
|
|
bool bdrv_dirty_iter_next_area(BdrvDirtyBitmapIter *iter, uint64_t max_offset,
|
|
|
|
uint64_t *offset, int *bytes);
|
2017-09-25 16:55:16 +02:00
|
|
|
void bdrv_set_dirty_iter(BdrvDirtyBitmapIter *hbi, int64_t offset);
|
2017-06-05 14:39:05 +02:00
|
|
|
int64_t bdrv_get_dirty_count(BdrvDirtyBitmap *bitmap);
|
|
|
|
int64_t bdrv_get_meta_dirty_count(BdrvDirtyBitmap *bitmap);
|
2017-09-25 16:55:11 +02:00
|
|
|
void bdrv_dirty_bitmap_truncate(BlockDriverState *bs, int64_t bytes);
|
2017-06-28 14:05:10 +02:00
|
|
|
bool bdrv_dirty_bitmap_readonly(const BdrvDirtyBitmap *bitmap);
|
|
|
|
bool bdrv_has_readonly_bitmaps(BlockDriverState *bs);
|
2017-06-28 14:05:15 +02:00
|
|
|
bool bdrv_dirty_bitmap_get_autoload(const BdrvDirtyBitmap *bitmap);
|
2017-06-28 14:05:17 +02:00
|
|
|
bool bdrv_dirty_bitmap_get_persistance(BdrvDirtyBitmap *bitmap);
|
2018-03-13 20:34:00 +01:00
|
|
|
bool bdrv_dirty_bitmap_qmp_locked(BdrvDirtyBitmap *bitmap);
|
2017-06-28 14:05:17 +02:00
|
|
|
bool bdrv_has_changed_persistent_bitmaps(BlockDriverState *bs);
|
2017-06-28 14:05:18 +02:00
|
|
|
BdrvDirtyBitmap *bdrv_dirty_bitmap_next(BlockDriverState *bs,
|
|
|
|
BdrvDirtyBitmap *bitmap);
|
2017-06-28 14:05:25 +02:00
|
|
|
char *bdrv_dirty_bitmap_sha256(const BdrvDirtyBitmap *bitmap, Error **errp);
|
2017-10-12 15:53:09 +02:00
|
|
|
int64_t bdrv_dirty_bitmap_next_zero(BdrvDirtyBitmap *bitmap, uint64_t start);
|
2018-03-13 20:34:00 +01:00
|
|
|
BdrvDirtyBitmap *bdrv_reclaim_dirty_bitmap_locked(BlockDriverState *bs,
|
|
|
|
BdrvDirtyBitmap *bitmap,
|
|
|
|
Error **errp);
|
2017-06-05 14:39:05 +02:00
|
|
|
|
2016-03-08 05:44:55 +01:00
|
|
|
#endif
|