From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39167) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6Gem-0002ta-Ui for qemu-devel@nongnu.org; Mon, 05 Aug 2013 05:00:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6Ged-0005uy-CA for qemu-devel@nongnu.org; Mon, 05 Aug 2013 05:00:48 -0400 Received: from e23smtp05.au.ibm.com ([202.81.31.147]:52605) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6Gea-0005t7-PM for qemu-devel@nongnu.org; Mon, 05 Aug 2013 05:00:39 -0400 Received: from /spool/local by e23smtp05.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 5 Aug 2013 18:53:38 +1000 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [9.190.235.152]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id 220C42CE804D for ; Mon, 5 Aug 2013 19:00:28 +1000 (EST) Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r758ieHD4653530 for ; Mon, 5 Aug 2013 18:44:40 +1000 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r7590Q66008567 for ; Mon, 5 Aug 2013 19:00:27 +1000 Message-ID: <51FF6977.4090606@linux.vnet.ibm.com> Date: Mon, 05 Aug 2013 16:59:35 +0800 From: Lei Li MIME-Version: 1.0 References: <1374411399-17535-1-git-send-email-lilei@linux.vnet.ibm.com> <51EFF74D.7050805@linux.vnet.ibm.com> In-Reply-To: <51EFF74D.7050805@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] savevm: set right return value for qemu_file_rate_limit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: pbonzini@redhat.com, qemu-devel Cc: Lei Li , quintela@redhat.com PING? any comments? On 07/24/2013 11:48 PM, Lei Li wrote: > In the logic of ram_save_iterate(), it checks the ret of > qemu_file_rate_limit(f) > by ret < 0 if there has been an error. But now it will never return > negative value > because qemu_file_rate_limit() return 1 if qemu_file_get_error(). > > Also the original implementation of qemu_file_rate_limit() as function > buffered_rate_limit() did return negative for this situation. > > > On 07/21/2013 08:56 PM, Lei Li wrote: >> Commit 1964a397063967acc5ce71a2a24ed26e74824ee1 refactors rate >> limiting to QEMUFile, but set the return value for qemu_file_rate_limit >> to 1 in the case of qemu_file_get_error. It is wrong and should be >> negative >> compared to the original function buffered_rate_limit and the current >> logic >> in ram_save_iterate. As qemu_file_rate_limit is called manually to >> determine >> if it has to exit, add the defination of the meaning of the return >> values >> as well. >> >> >> Signed-off-by: Lei Li >> --- >> savevm.c | 14 ++++++++++++-- >> 1 files changed, 12 insertions(+), 2 deletions(-) >> >> diff --git a/savevm.c b/savevm.c >> index e0491e7..f406790 100644 >> --- a/savevm.c >> +++ b/savevm.c >> @@ -904,10 +904,20 @@ int64_t qemu_ftell(QEMUFile *f) >> return f->pos; >> } >> >> +/* >> + * The meaning of the return values is: >> + * 0: We can continue sending >> + * 1: Time to stop >> + * negative: There has been an error >> + */ >> + >> int qemu_file_rate_limit(QEMUFile *f) >> { >> - if (qemu_file_get_error(f)) { >> - return 1; >> + int ret; >> + >> + ret = qemu_file_get_error(f); >> + if (ret) { >> + return ret; >> } >> if (f->xfer_limit > 0 && f->bytes_xfer > f->xfer_limit) { >> return 1; > > -- Lei