QEMU-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [Qemu-devel] [PATCH v2] migration: cleanup check on ops in savevm.handlers iterations
@ 2019-08-19  3:28 Wei Yang
  2019-08-19 13:50 ` Juan Quintela
  2019-09-12  9:55 ` Dr. David Alan Gilbert
  0 siblings, 2 replies; 4+ messages in thread
From: Wei Yang @ 2019-08-19  3:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: Wei Yang, dgilbert, quintela

During migration, there are several places to iterate on
savevm.handlers. And on each iteration, we need to check its ops and
related callbacks before invoke it.

Generally, ops is the first element to check, and it is only necessary
to check it once.

This patch clean all the related part in savevm.c to check ops only once
in those iterations.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>

---
v2: rebase on latest upstream
---
 migration/savevm.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/migration/savevm.c b/migration/savevm.c
index 4a86128ac4..35426d1db8 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1100,7 +1100,7 @@ void qemu_savevm_state_setup(QEMUFile *f)
         if (!se->ops || !se->ops->save_setup) {
             continue;
         }
-        if (se->ops && se->ops->is_active) {
+        if (se->ops->is_active) {
             if (!se->ops->is_active(se->opaque)) {
                 continue;
             }
@@ -1131,7 +1131,7 @@ int qemu_savevm_state_resume_prepare(MigrationState *s)
         if (!se->ops || !se->ops->resume_prepare) {
             continue;
         }
-        if (se->ops && se->ops->is_active) {
+        if (se->ops->is_active) {
             if (!se->ops->is_active(se->opaque)) {
                 continue;
             }
@@ -1227,7 +1227,7 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *f)
         if (!se->ops || !se->ops->save_live_complete_postcopy) {
             continue;
         }
-        if (se->ops && se->ops->is_active) {
+        if (se->ops->is_active) {
             if (!se->ops->is_active(se->opaque)) {
                 continue;
             }
@@ -1264,7 +1264,7 @@ int qemu_savevm_state_complete_precopy_iterable(QEMUFile *f, bool in_postcopy)
             continue;
         }
 
-        if (se->ops && se->ops->is_active) {
+        if (se->ops->is_active) {
             if (!se->ops->is_active(se->opaque)) {
                 continue;
             }
@@ -1413,7 +1413,7 @@ void qemu_savevm_state_pending(QEMUFile *f, uint64_t threshold_size,
         if (!se->ops || !se->ops->save_live_pending) {
             continue;
         }
-        if (se->ops && se->ops->is_active) {
+        if (se->ops->is_active) {
             if (!se->ops->is_active(se->opaque)) {
                 continue;
             }
@@ -2334,7 +2334,7 @@ static int qemu_loadvm_state_setup(QEMUFile *f)
         if (!se->ops || !se->ops->load_setup) {
             continue;
         }
-        if (se->ops && se->ops->is_active) {
+        if (se->ops->is_active) {
             if (!se->ops->is_active(se->opaque)) {
                 continue;
             }
-- 
2.17.1



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v2] migration: cleanup check on ops in savevm.handlers iterations
  2019-08-19  3:28 [Qemu-devel] [PATCH v2] migration: cleanup check on ops in savevm.handlers iterations Wei Yang
@ 2019-08-19 13:50 ` Juan Quintela
  2019-08-19 14:09   ` Wei Yang
  2019-09-12  9:55 ` Dr. David Alan Gilbert
  1 sibling, 1 reply; 4+ messages in thread
From: Juan Quintela @ 2019-08-19 13:50 UTC (permalink / raw)
  To: Wei Yang; +Cc: qemu-devel, dgilbert

Wei Yang <richardw.yang@linux.intel.com> wrote:
> During migration, there are several places to iterate on
> savevm.handlers. And on each iteration, we need to check its ops and
> related callbacks before invoke it.
>
> Generally, ops is the first element to check, and it is only necessary
> to check it once.
>
> This patch clean all the related part in savevm.c to check ops only once
> in those iterations.
>
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>

Reviewed-by: Juan Quintela <quintela@redhat.com>

Nice cleanup.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v2] migration: cleanup check on ops in savevm.handlers iterations
  2019-08-19 13:50 ` Juan Quintela
@ 2019-08-19 14:09   ` Wei Yang
  0 siblings, 0 replies; 4+ messages in thread
From: Wei Yang @ 2019-08-19 14:09 UTC (permalink / raw)
  To: Juan Quintela; +Cc: Wei Yang, dgilbert, qemu-devel

On Mon, Aug 19, 2019 at 03:50:44PM +0200, Juan Quintela wrote:
>Wei Yang <richardw.yang@linux.intel.com> wrote:
>> During migration, there are several places to iterate on
>> savevm.handlers. And on each iteration, we need to check its ops and
>> related callbacks before invoke it.
>>
>> Generally, ops is the first element to check, and it is only necessary
>> to check it once.
>>
>> This patch clean all the related part in savevm.c to check ops only once
>> in those iterations.
>>
>> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
>
>Reviewed-by: Juan Quintela <quintela@redhat.com>
>
>Nice cleanup.

Thanks

-- 
Wei Yang
Help you, Help me


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v2] migration: cleanup check on ops in savevm.handlers iterations
  2019-08-19  3:28 [Qemu-devel] [PATCH v2] migration: cleanup check on ops in savevm.handlers iterations Wei Yang
  2019-08-19 13:50 ` Juan Quintela
@ 2019-09-12  9:55 ` Dr. David Alan Gilbert
  1 sibling, 0 replies; 4+ messages in thread
From: Dr. David Alan Gilbert @ 2019-09-12  9:55 UTC (permalink / raw)
  To: Wei Yang; +Cc: qemu-devel, quintela

* Wei Yang (richardw.yang@linux.intel.com) wrote:
> During migration, there are several places to iterate on
> savevm.handlers. And on each iteration, we need to check its ops and
> related callbacks before invoke it.
> 
> Generally, ops is the first element to check, and it is only necessary
> to check it once.
> 
> This patch clean all the related part in savevm.c to check ops only once
> in those iterations.
> 
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>

Queued

> 
> ---
> v2: rebase on latest upstream
> ---
>  migration/savevm.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 4a86128ac4..35426d1db8 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -1100,7 +1100,7 @@ void qemu_savevm_state_setup(QEMUFile *f)
>          if (!se->ops || !se->ops->save_setup) {
>              continue;
>          }
> -        if (se->ops && se->ops->is_active) {
> +        if (se->ops->is_active) {
>              if (!se->ops->is_active(se->opaque)) {
>                  continue;
>              }
> @@ -1131,7 +1131,7 @@ int qemu_savevm_state_resume_prepare(MigrationState *s)
>          if (!se->ops || !se->ops->resume_prepare) {
>              continue;
>          }
> -        if (se->ops && se->ops->is_active) {
> +        if (se->ops->is_active) {
>              if (!se->ops->is_active(se->opaque)) {
>                  continue;
>              }
> @@ -1227,7 +1227,7 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *f)
>          if (!se->ops || !se->ops->save_live_complete_postcopy) {
>              continue;
>          }
> -        if (se->ops && se->ops->is_active) {
> +        if (se->ops->is_active) {
>              if (!se->ops->is_active(se->opaque)) {
>                  continue;
>              }
> @@ -1264,7 +1264,7 @@ int qemu_savevm_state_complete_precopy_iterable(QEMUFile *f, bool in_postcopy)
>              continue;
>          }
>  
> -        if (se->ops && se->ops->is_active) {
> +        if (se->ops->is_active) {
>              if (!se->ops->is_active(se->opaque)) {
>                  continue;
>              }
> @@ -1413,7 +1413,7 @@ void qemu_savevm_state_pending(QEMUFile *f, uint64_t threshold_size,
>          if (!se->ops || !se->ops->save_live_pending) {
>              continue;
>          }
> -        if (se->ops && se->ops->is_active) {
> +        if (se->ops->is_active) {
>              if (!se->ops->is_active(se->opaque)) {
>                  continue;
>              }
> @@ -2334,7 +2334,7 @@ static int qemu_loadvm_state_setup(QEMUFile *f)
>          if (!se->ops || !se->ops->load_setup) {
>              continue;
>          }
> -        if (se->ops && se->ops->is_active) {
> +        if (se->ops->is_active) {
>              if (!se->ops->is_active(se->opaque)) {
>                  continue;
>              }
> -- 
> 2.17.1
> 
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-19  3:28 [Qemu-devel] [PATCH v2] migration: cleanup check on ops in savevm.handlers iterations Wei Yang
2019-08-19 13:50 ` Juan Quintela
2019-08-19 14:09   ` Wei Yang
2019-09-12  9:55 ` Dr. David Alan Gilbert

QEMU-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/qemu-devel/0 qemu-devel/git/0.git
	git clone --mirror https://lore.kernel.org/qemu-devel/1 qemu-devel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 qemu-devel qemu-devel/ https://lore.kernel.org/qemu-devel \
		qemu-devel@nongnu.org qemu-devel@archiver.kernel.org
	public-inbox-index qemu-devel


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.nongnu.qemu-devel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox