qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Lei Li <lilei@linux.vnet.ibm.com>
To: pbonzini@redhat.com, qemu-devel <qemu-devel@nongnu.org>
Cc: Lei Li <lilei@linux.vnet.ibm.com>, quintela@redhat.com
Subject: Re: [Qemu-devel] [PATCH] savevm: set right return value for qemu_file_rate_limit
Date: Wed, 24 Jul 2013 23:48:29 +0800	[thread overview]
Message-ID: <51EFF74D.7050805@linux.vnet.ibm.com> (raw)
In-Reply-To: <1374411399-17535-1-git-send-email-lilei@linux.vnet.ibm.com>

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 <lilei@linux.vnet.ibm.com>
> ---
>   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

  reply	other threads:[~2013-07-24 15:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-21 12:56 [Qemu-devel] [PATCH] savevm: set right return value for qemu_file_rate_limit Lei Li
2013-07-24 15:48 ` Lei Li [this message]
2013-08-05  8:59   ` Lei Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51EFF74D.7050805@linux.vnet.ibm.com \
    --to=lilei@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).