From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52992) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XtPZ9-00080U-Iu for qemu-devel@nongnu.org; Tue, 25 Nov 2014 18:30:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XtPZ3-0004s0-DJ for qemu-devel@nongnu.org; Tue, 25 Nov 2014 18:30:39 -0500 Received: from mail-oi0-x230.google.com ([2607:f8b0:4003:c06::230]:46165) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XtPZ3-0004rf-6t for qemu-devel@nongnu.org; Tue, 25 Nov 2014 18:30:33 -0500 Received: by mail-oi0-f48.google.com with SMTP id u20so1213875oif.21 for ; Tue, 25 Nov 2014 15:30:32 -0800 (PST) From: grhookatwork@gmail.com Date: Tue, 25 Nov 2014 17:30:02 -0600 Message-Id: <1416958202-15913-1-git-send-email-gary.hook@nimboxx.com> Subject: [Qemu-devel] [PATCH v2] Block migration: fix return value List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gary R Hook From: Gary R Hook 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. Signed-off-by: Gary R Hook --- block-migration.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/block-migration.c b/block-migration.c index 08db01a..74d9eb1 100644 --- a/block-migration.c +++ b/block-migration.c @@ -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. */ -- 1.9.1