* Don't zero ctx->save.stats; it is already zeroed
* No need for x as it duplicates ctx->save.stats.iteration
* Defer setting dirty_count until the bitmap has been filled to match the
behaviour of XEN_DOMCTL_SHADOW_OP_CLEAN
* Drop spurious blank line
Signed-off-by: Andrew Cooper
---
CC: Ian Jackson
CC: Wei Liu
CC: Julien Grall
---
tools/libxc/xc_sr_save.c | 13 +++--
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/tools/libxc/xc_sr_save.c b/tools/libxc/xc_sr_save.c
index beceb6a..afc5cb9 100644
--- a/tools/libxc/xc_sr_save.c
+++ b/tools/libxc/xc_sr_save.c
@@ -495,7 +495,6 @@ static int send_memory_live(struct xc_sr_context *ctx)
xc_interface *xch = ctx->xch;
xc_shadow_op_stats_t stats = { 0, ctx->save.p2m_size };
char *progress_str = NULL;
-unsigned int x = 0;
int rc;
int policy_decision;
@@ -506,23 +505,18 @@ static int send_memory_live(struct xc_sr_context *ctx)
ctx->save.callbacks->precopy_policy ?: simple_precopy_policy;
void *data = ctx->save.callbacks->data;
-
-struct precopy_stats *policy_stats;
+struct precopy_stats *policy_stats = >save.stats;
rc = update_progress_string(ctx, _str);
if ( rc )
goto out;
-ctx->save.stats = (struct precopy_stats)
-{ .dirty_count = ctx->save.p2m_size };
-policy_stats = >save.stats;
-
bitmap_set(dirty_bitmap, ctx->save.p2m_size);
+policy_stats->dirty_count = ctx->save.p2m_size;
for ( ; ; )
{
policy_decision = precopy_policy(policy_stats, data);
-x++;
if ( stats.dirty_count > 0 && policy_decision != XGS_POLICY_ABORT )
{
@@ -538,7 +532,7 @@ static int send_memory_live(struct xc_sr_context *ctx)
if ( policy_decision != XGS_POLICY_CONTINUE_PRECOPY )
break;
-policy_stats->iteration = x;
+policy_stats->iteration++;
policy_stats->total_written += policy_stats->dirty_count;
policy_stats->dirty_count = -1;
@@ -558,7 +552,6 @@ static int send_memory_live(struct xc_sr_context *ctx)
}
policy_stats->dirty_count = stats.dirty_count;
-
}
out:
--
2.1.4
___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel