diff mbox

[v2,1/5] Postcopy: Avoid 0 length discards

Message ID 1461941263-9523-2-git-send-email-dgilbert@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dr. David Alan Gilbert April 29, 2016, 2:47 p.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>
---
 migration/ram.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Denis V. Lunev April 29, 2016, 3:03 p.m. UTC | #1
On 04/29/2016 05:47 PM, Dr. David Alan Gilbert (git) wrote:
> 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>
> ---
>   migration/ram.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/migration/ram.c b/migration/ram.c
> index 3f05738..e96c2af 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;
Reviewed-by: Denis V. Lunev <den@openvz.org>
diff mbox

Patch

diff --git a/migration/ram.c b/migration/ram.c
index 3f05738..e96c2af 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;