qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] savevm: set right return value for qemu_file_rate_limit
@ 2013-07-21 12:56 Lei Li
  2013-07-24 15:48 ` Lei Li
  0 siblings, 1 reply; 3+ messages in thread
From: Lei Li @ 2013-07-21 12:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Lei Li, quintela

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;
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-05  9:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2013-08-05  8:59   ` Lei Li

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).