diff mbox

[04/41] migration: push qemu_savevm_state_cancel out of qemu_savevm_state_*

Message ID 1360950433-17106-5-git-send-email-pbonzini@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini Feb. 15, 2013, 5:46 p.m. UTC
This is useful, because it lets us keep the cancellation callbacks
inside the big lock while pushing the others out.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 savevm.c |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)

Comments

Orit Wasserman Feb. 18, 2013, 9:15 a.m. UTC | #1
On 02/15/2013 07:46 PM, Paolo Bonzini wrote:
> This is useful, because it lets us keep the cancellation callbacks
> inside the big lock while pushing the others out.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  savevm.c |   15 ++++-----------
>  1 files changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/savevm.c b/savevm.c
> index a8a53ef..4302903 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -1621,17 +1621,11 @@ int qemu_savevm_state_begin(QEMUFile *f,
>  
>          ret = se->ops->save_live_setup(f, se->opaque);
>          if (ret < 0) {
> -            qemu_savevm_state_cancel();
>              return ret;
>          }
>      }
>      ret = qemu_file_get_error(f);
> -    if (ret != 0) {
> -        qemu_savevm_state_cancel();
> -    }
> -
>      return ret;
> -
>  }
>  
>  /*
> @@ -1677,9 +1671,6 @@ int qemu_savevm_state_iterate(QEMUFile *f)
>          return ret;
>      }
>      ret = qemu_file_get_error(f);
> -    if (ret != 0) {
> -        qemu_savevm_state_cancel();
> -    }
>      return ret;
>  }
>  
> @@ -1778,8 +1769,7 @@ static int qemu_savevm_state(QEMUFile *f)
>      };
>  
>      if (qemu_savevm_state_blocked(NULL)) {
> -        ret = -EINVAL;
> -        goto out;
> +        return -EINVAL;
>      }
>  
>      ret = qemu_savevm_state_begin(f, &params);
> @@ -1798,6 +1788,9 @@ out:
>      if (ret == 0) {
>          ret = qemu_file_get_error(f);
>      }
> +    if (ret != 0) {
> +        qemu_savevm_state_cancel();
> +    }
>  
>      return ret;
>  }
> 
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Juan Quintela Feb. 21, 2013, 5:17 p.m. UTC | #2
Paolo Bonzini <pbonzini@redhat.com> wrote:
> This is useful, because it lets us keep the cancellation callbacks
> inside the big lock while pushing the others out.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

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

If we need to rebase:

>      ret = qemu_file_get_error(f);
> -    if (ret != 0) {
> -        qemu_savevm_state_cancel();
> -    }
> -
>      return ret;

	return qemu_file_get_error(f);

looks better than:

	ret = qemu_file_get_error(f);
	return ret;

IMHO O:-)

> -
>  }
>  
>  /*
> @@ -1677,9 +1671,6 @@ int qemu_savevm_state_iterate(QEMUFile *f)
>          return ret;
>      }
>      ret = qemu_file_get_error(f);
> -    if (ret != 0) {
> -        qemu_savevm_state_cancel();
> -    }
>      return ret;

Same here
diff mbox

Patch

diff --git a/savevm.c b/savevm.c
index a8a53ef..4302903 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1621,17 +1621,11 @@  int qemu_savevm_state_begin(QEMUFile *f,
 
         ret = se->ops->save_live_setup(f, se->opaque);
         if (ret < 0) {
-            qemu_savevm_state_cancel();
             return ret;
         }
     }
     ret = qemu_file_get_error(f);
-    if (ret != 0) {
-        qemu_savevm_state_cancel();
-    }
-
     return ret;
-
 }
 
 /*
@@ -1677,9 +1671,6 @@  int qemu_savevm_state_iterate(QEMUFile *f)
         return ret;
     }
     ret = qemu_file_get_error(f);
-    if (ret != 0) {
-        qemu_savevm_state_cancel();
-    }
     return ret;
 }
 
@@ -1778,8 +1769,7 @@  static int qemu_savevm_state(QEMUFile *f)
     };
 
     if (qemu_savevm_state_blocked(NULL)) {
-        ret = -EINVAL;
-        goto out;
+        return -EINVAL;
     }
 
     ret = qemu_savevm_state_begin(f, &params);
@@ -1798,6 +1788,9 @@  out:
     if (ret == 0) {
         ret = qemu_file_get_error(f);
     }
+    if (ret != 0) {
+        qemu_savevm_state_cancel();
+    }
 
     return ret;
 }