cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-blockdev-Promote-several-bitmap-functions-to-non-sta.patch

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