[PATCH 9/9] migration: Unexport migration_is_active()

Avihai Horon posted 9 patches 3 months, 4 weeks ago
There is a newer version of this series
[PATCH 9/9] migration: Unexport migration_is_active()
Posted by Avihai Horon 3 months, 4 weeks ago
After being removed from VFIO and dirty limit, migration_is_active() no
longer has any users outside the migration subsystem, and in fact, it's
only used in migration.c.

Unexport it and also relocate it so it can be made static.

Signed-off-by: Avihai Horon <avihaih@nvidia.com>
---
 include/migration/misc.h |  1 -
 migration/migration.c    | 16 ++++++++--------
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/include/migration/misc.h b/include/migration/misc.h
index ad1e25826a..c0e23fdac9 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -53,7 +53,6 @@ void dump_vmstate_json_to_file(FILE *out_fp);
 void migration_object_init(void);
 void migration_shutdown(void);
 
-bool migration_is_active(void);
 bool migration_is_running(void);
 bool migration_thread_is_self(void);
 
diff --git a/migration/migration.c b/migration/migration.c
index 18ca60af4f..5bb0633e37 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1139,6 +1139,14 @@ bool migration_is_running(void)
     }
 }
 
+static bool migration_is_active(void)
+{
+    MigrationState *s = current_migration;
+
+    return (s->state == MIGRATION_STATUS_ACTIVE ||
+            s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE);
+}
+
 static bool migrate_show_downtime(MigrationState *s)
 {
     return (s->state == MIGRATION_STATUS_COMPLETED) || migration_in_postcopy();
@@ -1637,14 +1645,6 @@ bool migration_in_bg_snapshot(void)
     return migrate_background_snapshot() && migration_is_running();
 }
 
-bool migration_is_active(void)
-{
-    MigrationState *s = current_migration;
-
-    return (s->state == MIGRATION_STATUS_ACTIVE ||
-            s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE);
-}
-
 bool migration_thread_is_self(void)
 {
     MigrationState *s = current_migration;
-- 
2.40.1
Re: [PATCH 9/9] migration: Unexport migration_is_active()
Posted by Peter Xu 3 months, 4 weeks ago
On Mon, Dec 16, 2024 at 11:46:38AM +0200, Avihai Horon wrote:
> After being removed from VFIO and dirty limit, migration_is_active() no
> longer has any users outside the migration subsystem, and in fact, it's
> only used in migration.c.
> 
> Unexport it and also relocate it so it can be made static.
> 
> Signed-off-by: Avihai Horon <avihaih@nvidia.com>

Acked-by: Peter Xu <peterx@redhat.com>

-- 
Peter Xu
Re: [PATCH 9/9] migration: Unexport migration_is_active()
Posted by Cédric Le Goater 3 months, 4 weeks ago
On 12/16/24 10:46, Avihai Horon wrote:
> After being removed from VFIO and dirty limit, migration_is_active() no
> longer has any users outside the migration subsystem, and in fact, it's
> only used in migration.c.
> 
> Unexport it and also relocate it so it can be made static.
> 
> Signed-off-by: Avihai Horon <avihaih@nvidia.com>


Reviewed-by: Cédric Le Goater <clg@redhat.com>

Thanks,

C.


> ---
>   include/migration/misc.h |  1 -
>   migration/migration.c    | 16 ++++++++--------
>   2 files changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/include/migration/misc.h b/include/migration/misc.h
> index ad1e25826a..c0e23fdac9 100644
> --- a/include/migration/misc.h
> +++ b/include/migration/misc.h
> @@ -53,7 +53,6 @@ void dump_vmstate_json_to_file(FILE *out_fp);
>   void migration_object_init(void);
>   void migration_shutdown(void);
>   
> -bool migration_is_active(void);
>   bool migration_is_running(void);
>   bool migration_thread_is_self(void);
>   
> diff --git a/migration/migration.c b/migration/migration.c
> index 18ca60af4f..5bb0633e37 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -1139,6 +1139,14 @@ bool migration_is_running(void)
>       }
>   }
>   
> +static bool migration_is_active(void)
> +{
> +    MigrationState *s = current_migration;
> +
> +    return (s->state == MIGRATION_STATUS_ACTIVE ||
> +            s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE);
> +}
> +
>   static bool migrate_show_downtime(MigrationState *s)
>   {
>       return (s->state == MIGRATION_STATUS_COMPLETED) || migration_in_postcopy();
> @@ -1637,14 +1645,6 @@ bool migration_in_bg_snapshot(void)
>       return migrate_background_snapshot() && migration_is_running();
>   }
>   
> -bool migration_is_active(void)
> -{
> -    MigrationState *s = current_migration;
> -
> -    return (s->state == MIGRATION_STATUS_ACTIVE ||
> -            s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE);
> -}
> -
>   bool migration_thread_is_self(void)
>   {
>       MigrationState *s = current_migration;