Patchwork [v2,04/12] savevm: add error parameter to qemu_savevm_state_iterate()

login
register
mail settings
Submitter Pavel Hrdina
Date March 22, 2013, 1:16 p.m.
Message ID <2807cb1036d5412c76b83d70aebfbbb27e24001d.1363957855.git.phrdina@redhat.com>
Download mbox | patch
Permalink /patch/230009/
State New
Headers show

Comments

Pavel Hrdina - March 22, 2013, 1:16 p.m.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 include/sysemu/sysemu.h | 2 +-
 migration.c             | 2 +-
 savevm.c                | 5 ++---
 3 files changed, 4 insertions(+), 5 deletions(-)
Eric Blake - March 26, 2013, 4:55 p.m.
On 03/22/2013 07:16 AM, Pavel Hrdina wrote:
> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> ---
>  include/sysemu/sysemu.h | 2 +-
>  migration.c             | 2 +-
>  savevm.c                | 5 ++---
>  3 files changed, 4 insertions(+), 5 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>


> @@ -1811,9 +1811,8 @@ static int qemu_savevm_state(QEMUFile *f)
>      qemu_savevm_state_begin(f, &params, NULL);
>      qemu_mutex_lock_iothread();
>  
> -
>      while (qemu_file_get_error(f) == 0) {

Spurious whitespace change will go away when you fix 3/12 to not
introduce it in the first place.

> -        if (qemu_savevm_state_iterate(f) > 0) {
> +        if (qemu_savevm_state_iterate(f, NULL) > 0) {
>              break;
>          }
>      }
>

Patch

diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 2f35a05..af4f699 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -76,7 +76,7 @@  bool qemu_savevm_state_blocked(Error **errp);
 void qemu_savevm_state_begin(QEMUFile *f,
                              const MigrationParams *params,
                              Error **errp);
-int qemu_savevm_state_iterate(QEMUFile *f);
+int qemu_savevm_state_iterate(QEMUFile *f, Error **errp);
 void qemu_savevm_state_complete(QEMUFile *f);
 void qemu_savevm_state_cancel(void);
 uint64_t qemu_savevm_state_pending(QEMUFile *f, uint64_t max_size);
diff --git a/migration.c b/migration.c
index 66cba46..c2bf531 100644
--- a/migration.c
+++ b/migration.c
@@ -515,7 +515,7 @@  static void *migration_thread(void *opaque)
             pending_size = qemu_savevm_state_pending(s->file, max_size);
             DPRINTF("pending size %lu max %lu\n", pending_size, max_size);
             if (pending_size && pending_size >= max_size) {
-                qemu_savevm_state_iterate(s->file);
+                qemu_savevm_state_iterate(s->file, NULL);
             } else {
                 DPRINTF("done iterating\n");
                 qemu_mutex_lock_iothread();
diff --git a/savevm.c b/savevm.c
index 018e070..c5ac701 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1670,7 +1670,7 @@  void qemu_savevm_state_begin(QEMUFile *f,
  *   0 : We haven't finished, caller have to go again
  *   1 : We have finished, we can go to complete phase
  */
-int qemu_savevm_state_iterate(QEMUFile *f)
+int qemu_savevm_state_iterate(QEMUFile *f, Error **errp)
 {
     SaveStateEntry *se;
     int ret = 1;
@@ -1811,9 +1811,8 @@  static int qemu_savevm_state(QEMUFile *f)
     qemu_savevm_state_begin(f, &params, NULL);
     qemu_mutex_lock_iothread();
 
-
     while (qemu_file_get_error(f) == 0) {
-        if (qemu_savevm_state_iterate(f) > 0) {
+        if (qemu_savevm_state_iterate(f, NULL) > 0) {
             break;
         }
     }