Skip to contentSkip to conversation

Block migration: fix return value

PATCH Applied [email protected] 3 participants 4 messages Nov 25, 2014 – Dec 9, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Block migration: fix return value

From: Gary R Hook <[email protected]>

Modify block_save_iterate() to return positive/zero/negative (success/not done/failure) return status. The computation of the blocks transferred (an int64_t) exceeds the size of an int return value.

---
 block-migration.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
block-migration.c +9 -1
index 08db01a..74d9eb1 100644
@@ -653,6 +653,7 @@ static int block_save_iterate(QEMUFile *f, void *opaque)
 {
     int ret;
     int64_t last_ftell = qemu_ftell(f);
+    int64_t delta_ftell;
 
     DPRINTF("Enter save live iterate submitted %d transferred %d\n",
             block_mig_state.submitted, block_mig_state.transferred);
@@ -702,7 +703,14 @@ static int block_save_iterate(QEMUFile *f, void *opaque)
     }
 
     qemu_put_be64(f, BLK_MIG_FLAG_EOS);
-    return qemu_ftell(f) - last_ftell;
+    delta_ftell = qemu_ftell(f) - last_ftell;
+    if (delta_ftell > 0) {
+        return 1;
+    } else if (delta_ftell < 0) {
+        return -1;
+    } else {
+        return 0;
+    }
 }
 
 /* Called with iothread lock taken.  */
Signature · 1 line
1.9.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 31 lines · On 2014/11/26 7:30, [email protected] wrote:

From: Gary R Hook <[email protected]>

Modify block_save_iterate() to return positive/zero/negative (success/not done/failure) return status. The computation of the blocks transferred (an int64_t) exceeds the size of an int return value.

---
 block-migration.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
block-migration.c +2 -1
index 08db01a..74d9eb1 100644
@@ -653,6 +653,7 @@ static int block_save_iterate(QEMUFile *f, void *opaque)
 {
     int ret;
     int64_t last_ftell = qemu_ftell(f);
+    int64_t delta_ftell;
 
     DPRINTF("Enter save live iterate submitted %d transferred %d\n",
             block_mig_state.submitted, block_mig_state.transferred);
@@ -702,7 +703,14 @@ static int block_save_iterate(QEMUFile *f, void *opaque)
     }
 
     qemu_put_be64(f, BLK_MIG_FLAG_EOS);
-    return qemu_ftell(f) - last_ftell;
+    delta_ftell = qemu_ftell(f) - last_ftell;

block-migration.c static int block_save_iterate(QEMUFile *f, void *opaque) · line 716

Quoted 10 lines
block-migration.c +7 -0
+    if (delta_ftell > 0) {
+        return 1;
+    } else if (delta_ftell < 0) {
+        return -1;
+    } else {
+        return 0;
+    }
 }
 
 /* Called with iothread lock taken.  */
Reviewed-by on v2 1/1
#2 lore raw
In reply to [email protected]
Quoted 7 lines · On Tue, Nov 25, 2014 at 05:30:02PM -0600, [email protected] wrote:

From: Gary R Hook <[email protected]>

Modify block_save_iterate() to return positive/zero/negative (success/not done/failure) return status. The computation of the blocks transferred (an int64_t) exceeds the size of an int return value.

Quoted 5 lines
---
 block-migration.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
#3 lore raw
In reply to [email protected]
Quoted 7 lines · On Tue, Nov 25, 2014 at 05:30:02PM -0600, [email protected] wrote:

From: Gary R Hook <[email protected]>

Modify block_save_iterate() to return positive/zero/negative (success/not done/failure) return status. The computation of the blocks transferred (an int64_t) exceeds the size of an int return value.

Quoted 5 lines
---
 block-migration.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Thanks, applied to my block-next tree:
https://github.com/stefanha/qemu/commits/block-next

Stefan