From 2046dc725f121b57f0bfb9805d4f4121a2b362d9 Mon Sep 17 00:00:00 2001
From: Juan Quintela <quintela@redhat.com>
Date: Fri, 4 Feb 2011 12:19:57 -0200
Subject: [RHEL6 qemu-kvm PATCH 21/27] No need to iterate if we already are over the limit

RH-Author: Juan Quintela <quintela@redhat.com>
Message-id: <8677ceb81b984a9992804fec3a734e2dc665c851.1296800499.git.quintela@redhat.com>
Patchwork-id: 17736
O-Subject: [PATCH 2/8] No need to iterate if we already are over the limit
Bugzilla: 643970
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>
RH-Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
RH-Acked-by: Amit Shah <amit.shah@redhat.com>

If buffers are full, don't iterate

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 savevm.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 savevm.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/savevm.c b/savevm.c
index c177f72..53a0b7f 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1503,6 +1503,9 @@ int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f)
         if (se->save_live_state == NULL)
             continue;
 
+        if (qemu_file_rate_limit(f))
+            return 0;
+
         /* Section type */
         qemu_put_byte(f, QEMU_VM_SECTION_PART);
         qemu_put_be32(f, se->section_id);
-- 
1.7.3.2

