|
|
77c23f |
From 0c8ba0a96a7d0cbf371f1a5fbee543e8b2cb2595 Mon Sep 17 00:00:00 2001
|
|
|
77c23f |
From: Eric Blake <eblake@redhat.com>
|
|
|
77c23f |
Date: Tue, 2 Jun 2020 02:34:13 +0100
|
|
|
77c23f |
Subject: [PATCH 08/26] blockdev: Promote several bitmap functions to
|
|
|
77c23f |
non-static
|
|
|
77c23f |
MIME-Version: 1.0
|
|
|
77c23f |
Content-Type: text/plain; charset=UTF-8
|
|
|
77c23f |
Content-Transfer-Encoding: 8bit
|
|
|
77c23f |
|
|
|
77c23f |
RH-Author: Eric Blake <eblake@redhat.com>
|
|
|
77c23f |
Message-id: <20200602023420.2133649-6-eblake@redhat.com>
|
|
|
77c23f |
Patchwork-id: 97077
|
|
|
77c23f |
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 05/12] blockdev: Promote several bitmap functions to non-static
|
|
|
77c23f |
Bugzilla: 1779893 1779904
|
|
|
77c23f |
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
77c23f |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
77c23f |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
77c23f |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
77c23f |
|
|
|
77c23f |
The next patch will split blockdev.c, which will require accessing
|
|
|
77c23f |
some previously-static functions from more than one .c file. But part
|
|
|
77c23f |
of promoting a function to public is picking a naming scheme that does
|
|
|
77c23f |
not reek of exposing too many internals (two of the three functions
|
|
|
77c23f |
were named starting with 'do_'). To make future code motion easier,
|
|
|
77c23f |
perform the function rename and non-static promotion into its own
|
|
|
77c23f |
patch.
|
|
|
77c23f |
|
|
|
77c23f |
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
77c23f |
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
|
|
77c23f |
Message-Id: <20200513011648.166876-5-eblake@redhat.com>
|
|
|
77c23f |
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
77c23f |
(cherry picked from commit c6996cf9a6c759c29919642be9a73ac64b38301b)
|
|
|
77c23f |
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
77c23f |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
77c23f |
---
|
|
|
77c23f |
blockdev.c | 47 +++++++++++++++++++----------------------------
|
|
|
77c23f |
include/block/block_int.h | 12 ++++++++++++
|
|
|
77c23f |
2 files changed, 31 insertions(+), 28 deletions(-)
|
|
|
77c23f |
|
|
|
77c23f |
diff --git a/blockdev.c b/blockdev.c
|
|
|
77c23f |
index 86eb115..3958058 100644
|
|
|
77c23f |
--- a/blockdev.c
|
|
|
77c23f |
+++ b/blockdev.c
|
|
|
77c23f |
@@ -1262,10 +1262,10 @@ out_aio_context:
|
|
|
77c23f |
*
|
|
|
77c23f |
* @return: A bitmap object on success, or NULL on failure.
|
|
|
77c23f |
*/
|
|
|
77c23f |
-static BdrvDirtyBitmap *block_dirty_bitmap_lookup(const char *node,
|
|
|
77c23f |
- const char *name,
|
|
|
77c23f |
- BlockDriverState **pbs,
|
|
|
77c23f |
- Error **errp)
|
|
|
77c23f |
+BdrvDirtyBitmap *block_dirty_bitmap_lookup(const char *node,
|
|
|
77c23f |
+ const char *name,
|
|
|
77c23f |
+ BlockDriverState **pbs,
|
|
|
77c23f |
+ Error **errp)
|
|
|
77c23f |
{
|
|
|
77c23f |
BlockDriverState *bs;
|
|
|
77c23f |
BdrvDirtyBitmap *bitmap;
|
|
|
77c23f |
@@ -2241,11 +2241,6 @@ static void block_dirty_bitmap_disable_abort(BlkActionState *common)
|
|
|
77c23f |
}
|
|
|
77c23f |
}
|
|
|
77c23f |
|
|
|
77c23f |
-static BdrvDirtyBitmap *do_block_dirty_bitmap_merge(
|
|
|
77c23f |
- const char *node, const char *target,
|
|
|
77c23f |
- BlockDirtyBitmapMergeSourceList *bitmaps,
|
|
|
77c23f |
- HBitmap **backup, Error **errp);
|
|
|
77c23f |
-
|
|
|
77c23f |
static void block_dirty_bitmap_merge_prepare(BlkActionState *common,
|
|
|
77c23f |
Error **errp)
|
|
|
77c23f |
{
|
|
|
77c23f |
@@ -2259,15 +2254,11 @@ static void block_dirty_bitmap_merge_prepare(BlkActionState *common,
|
|
|
77c23f |
|
|
|
77c23f |
action = common->action->u.block_dirty_bitmap_merge.data;
|
|
|
77c23f |
|
|
|
77c23f |
- state->bitmap = do_block_dirty_bitmap_merge(action->node, action->target,
|
|
|
77c23f |
- action->bitmaps, &state->backup,
|
|
|
77c23f |
- errp);
|
|
|
77c23f |
+ state->bitmap = block_dirty_bitmap_merge(action->node, action->target,
|
|
|
77c23f |
+ action->bitmaps, &state->backup,
|
|
|
77c23f |
+ errp);
|
|
|
77c23f |
}
|
|
|
77c23f |
|
|
|
77c23f |
-static BdrvDirtyBitmap *do_block_dirty_bitmap_remove(
|
|
|
77c23f |
- const char *node, const char *name, bool release,
|
|
|
77c23f |
- BlockDriverState **bitmap_bs, Error **errp);
|
|
|
77c23f |
-
|
|
|
77c23f |
static void block_dirty_bitmap_remove_prepare(BlkActionState *common,
|
|
|
77c23f |
Error **errp)
|
|
|
77c23f |
{
|
|
|
77c23f |
@@ -2281,8 +2272,8 @@ static void block_dirty_bitmap_remove_prepare(BlkActionState *common,
|
|
|
77c23f |
|
|
|
77c23f |
action = common->action->u.block_dirty_bitmap_remove.data;
|
|
|
77c23f |
|
|
|
77c23f |
- state->bitmap = do_block_dirty_bitmap_remove(action->node, action->name,
|
|
|
77c23f |
- false, &state->bs, errp);
|
|
|
77c23f |
+ state->bitmap = block_dirty_bitmap_remove(action->node, action->name,
|
|
|
77c23f |
+ false, &state->bs, errp);
|
|
|
77c23f |
if (state->bitmap) {
|
|
|
77c23f |
bdrv_dirty_bitmap_skip_store(state->bitmap, true);
|
|
|
77c23f |
bdrv_dirty_bitmap_set_busy(state->bitmap, true);
|
|
|
77c23f |
@@ -3046,9 +3037,10 @@ out:
|
|
|
77c23f |
aio_context_release(aio_context);
|
|
|
77c23f |
}
|
|
|
77c23f |
|
|
|
77c23f |
-static BdrvDirtyBitmap *do_block_dirty_bitmap_remove(
|
|
|
77c23f |
- const char *node, const char *name, bool release,
|
|
|
77c23f |
- BlockDriverState **bitmap_bs, Error **errp)
|
|
|
77c23f |
+BdrvDirtyBitmap *block_dirty_bitmap_remove(const char *node, const char *name,
|
|
|
77c23f |
+ bool release,
|
|
|
77c23f |
+ BlockDriverState **bitmap_bs,
|
|
|
77c23f |
+ Error **errp)
|
|
|
77c23f |
{
|
|
|
77c23f |
BlockDriverState *bs;
|
|
|
77c23f |
BdrvDirtyBitmap *bitmap;
|
|
|
77c23f |
@@ -3090,7 +3082,7 @@ static BdrvDirtyBitmap *do_block_dirty_bitmap_remove(
|
|
|
77c23f |
void qmp_block_dirty_bitmap_remove(const char *node, const char *name,
|
|
|
77c23f |
Error **errp)
|
|
|
77c23f |
{
|
|
|
77c23f |
- do_block_dirty_bitmap_remove(node, name, true, NULL, errp);
|
|
|
77c23f |
+ block_dirty_bitmap_remove(node, name, true, NULL, errp);
|
|
|
77c23f |
}
|
|
|
77c23f |
|
|
|
77c23f |
/**
|
|
|
77c23f |
@@ -3151,10 +3143,9 @@ void qmp_block_dirty_bitmap_disable(const char *node, const char *name,
|
|
|
77c23f |
bdrv_disable_dirty_bitmap(bitmap);
|
|
|
77c23f |
}
|
|
|
77c23f |
|
|
|
77c23f |
-static BdrvDirtyBitmap *do_block_dirty_bitmap_merge(
|
|
|
77c23f |
- const char *node, const char *target,
|
|
|
77c23f |
- BlockDirtyBitmapMergeSourceList *bitmaps,
|
|
|
77c23f |
- HBitmap **backup, Error **errp)
|
|
|
77c23f |
+BdrvDirtyBitmap *block_dirty_bitmap_merge(const char *node, const char *target,
|
|
|
77c23f |
+ BlockDirtyBitmapMergeSourceList *bms,
|
|
|
77c23f |
+ HBitmap **backup, Error **errp)
|
|
|
77c23f |
{
|
|
|
77c23f |
BlockDriverState *bs;
|
|
|
77c23f |
BdrvDirtyBitmap *dst, *src, *anon;
|
|
|
77c23f |
@@ -3172,7 +3163,7 @@ static BdrvDirtyBitmap *do_block_dirty_bitmap_merge(
|
|
|
77c23f |
return NULL;
|
|
|
77c23f |
}
|
|
|
77c23f |
|
|
|
77c23f |
- for (lst = bitmaps; lst; lst = lst->next) {
|
|
|
77c23f |
+ for (lst = bms; lst; lst = lst->next) {
|
|
|
77c23f |
switch (lst->value->type) {
|
|
|
77c23f |
const char *name, *node;
|
|
|
77c23f |
case QTYPE_QSTRING:
|
|
|
77c23f |
@@ -3217,7 +3208,7 @@ void qmp_block_dirty_bitmap_merge(const char *node, const char *target,
|
|
|
77c23f |
BlockDirtyBitmapMergeSourceList *bitmaps,
|
|
|
77c23f |
Error **errp)
|
|
|
77c23f |
{
|
|
|
77c23f |
- do_block_dirty_bitmap_merge(node, target, bitmaps, NULL, errp);
|
|
|
77c23f |
+ block_dirty_bitmap_merge(node, target, bitmaps, NULL, errp);
|
|
|
77c23f |
}
|
|
|
77c23f |
|
|
|
77c23f |
BlockDirtyBitmapSha256 *qmp_x_debug_block_dirty_bitmap_sha256(const char *node,
|
|
|
77c23f |
diff --git a/include/block/block_int.h b/include/block/block_int.h
|
|
|
77c23f |
index cc18e8d..876a83d 100644
|
|
|
77c23f |
--- a/include/block/block_int.h
|
|
|
77c23f |
+++ b/include/block/block_int.h
|
|
|
77c23f |
@@ -1341,4 +1341,16 @@ int coroutine_fn bdrv_co_create_opts_simple(BlockDriver *drv,
|
|
|
77c23f |
Error **errp);
|
|
|
77c23f |
extern QemuOptsList bdrv_create_opts_simple;
|
|
|
77c23f |
|
|
|
77c23f |
+BdrvDirtyBitmap *block_dirty_bitmap_lookup(const char *node,
|
|
|
77c23f |
+ const char *name,
|
|
|
77c23f |
+ BlockDriverState **pbs,
|
|
|
77c23f |
+ Error **errp);
|
|
|
77c23f |
+BdrvDirtyBitmap *block_dirty_bitmap_merge(const char *node, const char *target,
|
|
|
77c23f |
+ BlockDirtyBitmapMergeSourceList *bms,
|
|
|
77c23f |
+ HBitmap **backup, Error **errp);
|
|
|
77c23f |
+BdrvDirtyBitmap *block_dirty_bitmap_remove(const char *node, const char *name,
|
|
|
77c23f |
+ bool release,
|
|
|
77c23f |
+ BlockDriverState **bitmap_bs,
|
|
|
77c23f |
+ Error **errp);
|
|
|
77c23f |
+
|
|
|
77c23f |
#endif /* BLOCK_INT_H */
|
|
|
77c23f |
--
|
|
|
77c23f |
1.8.3.1
|
|
|
77c23f |
|