From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9H0X-00058R-Vd for qemu-devel@nongnu.org; Thu, 08 Jan 2015 12:36:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y9H06-0006xz-9I for qemu-devel@nongnu.org; Thu, 08 Jan 2015 12:36:29 -0500 Received: from e33.co.us.ibm.com ([32.97.110.151]:38348) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9H05-0006xf-VO for qemu-devel@nongnu.org; Thu, 08 Jan 2015 12:36:02 -0500 Received: from /spool/local by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Jan 2015 10:36:01 -0700 From: Michael Roth Date: Thu, 8 Jan 2015 11:34:23 -0600 Message-Id: <1420738472-23267-80-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1420738472-23267-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1420738472-23267-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 79/88] block migration: fix return value List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org 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 Reviewed-by: ChenLiang Reviewed-by: Stefan Hajnoczi Message-id: 1416958202-15913-1-git-send-email-gary.hook@nimboxx.com Signed-off-by: Stefan Hajnoczi (cherry picked from commit ebd9fbd7e102c533143c2c8372312b75c2b2678a) Signed-off-by: Michael Roth --- block-migration.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/block-migration.c b/block-migration.c index 73cdd07..2bb98d8 100644 --- a/block-migration.c +++ b/block-migration.c @@ -652,6 +652,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); @@ -701,7 +702,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