diff mbox

[PULL,1/8] Postcopy: Avoid 0 length discards

Message ID 4f2de508a7668a5c70ee586c9cc4b3e570fb833b.1465541858.git.amit.shah@redhat.com
State New
Headers show

Commit Message

Amit Shah June 10, 2016, 7 a.m. UTC
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

The discard code in migration/ram.c would send request for
zero length discards in the case where no discards were needed.
It doesn't appear to have had any bad effect.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Denis V. Lunev <den@openvz.org>
Message-Id: <1463489755-30703-2-git-send-email-dgilbert@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 migration/ram.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/migration/ram.c b/migration/ram.c
index 844ea46..5f929d6 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1557,7 +1557,9 @@  static int postcopy_send_discard_bm_ram(MigrationState *ms,
             } else {
                 discard_length = zero - one;
             }
-            postcopy_discard_send_range(ms, pds, one, discard_length);
+            if (discard_length) {
+                postcopy_discard_send_range(ms, pds, one, discard_length);
+            }
             current = one + discard_length;
         } else {
             current = one;