Postcopy: Avoid 0 length discards

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: 1465816605-29488-2-git-send-email-dgilbert@redhat.com
Message-Id: <1465816605-29488-2-git-send-email-dgilbert@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
This commit is contained in:
Dr. David Alan Gilbert 2016-06-13 12:16:40 +01:00 committed by Amit Shah
parent 49237b856a
commit d688c62d09
1 changed files with 3 additions and 1 deletions

View File

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