[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v7 20/42] Modify save_live_pending for postcopy
From: |
Juan Quintela |
Subject: |
Re: [Qemu-devel] [PATCH v7 20/42] Modify save_live_pending for postcopy |
Date: |
Mon, 13 Jul 2015 13:12:46 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
"Dr. David Alan Gilbert (git)" <address@hidden> wrote:
> From: "Dr. David Alan Gilbert" <address@hidden>
>
> Modify save_live_pending to return separate postcopiable and
> non-postcopiable counts.
>
> Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
I think that if you make a small change of meaning, everything gots easier:
> -static uint64_t block_save_pending(QEMUFile *f, void *opaque, uint64_t
> max_size)
> +static void block_save_pending(QEMUFile *f, void *opaque, uint64_t max_size,
> + uint64_t *non_postcopiable_pending,
> + uint64_t *postcopiable_pending)
> {
> /* Estimate pending number of bytes to send */
> uint64_t pending;
> @@ -773,7 +775,8 @@ static uint64_t block_save_pending(QEMUFile *f, void
> *opaque, uint64_t max_size)
> qemu_mutex_unlock_iothread();
>
> DPRINTF("Enter save live pending %" PRIu64 "\n", pending);
> - return pending;
> + *non_postcopiable_pending = pending;
> + *postcopiable_pending = 0;
Change that two lines to:
*non_postcopiable_pending += pending;
*postcopiable_pending += 0; /* ok, equivalent of doing nothing */
This way, chaining gots easier?
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 2c4cbe1..ebd3d31 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -1012,10 +1012,20 @@ void qemu_savevm_state_complete_precopy(QEMUFile *f)
> qemu_fflush(f);
> }
>
> -uint64_t qemu_savevm_state_pending(QEMUFile *f, uint64_t max_size)
> +/* Give an estimate of the amount left to be transferred,
> + * the result is split into the amount for units that can and
> + * for units that can't do postcopy.
> + */
> +void qemu_savevm_state_pending(QEMUFile *f, uint64_t max_size,
> + uint64_t *res_non_postcopiable,
> + uint64_t *res_postcopiable)
> {
> SaveStateEntry *se;
> - uint64_t ret = 0;
> + uint64_t tmp_non_postcopiable, tmp_postcopiable;
> +
> + *res_non_postcopiable = 0;
> + *res_postcopiable = 0;
> +
>
> QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
> if (!se->ops || !se->ops->save_live_pending) {
> @@ -1026,9 +1036,12 @@ uint64_t qemu_savevm_state_pending(QEMUFile *f,
> uint64_t max_size)
> continue;
> }
> }
> - ret += se->ops->save_live_pending(f, se->opaque, max_size);
> + se->ops->save_live_pending(f, se->opaque, max_size,
> + &tmp_non_postcopiable, &tmp_postcopiable);
> +
> + *res_postcopiable += tmp_postcopiable;
> + *res_non_postcopiable += tmp_non_postcopiable;
> }
> - return ret;
With the change, we don't care in the other functions, and this one gets
simpler IMHO.
- Re: [Qemu-devel] [PATCH v7 20/42] Modify save_live_pending for postcopy,
Juan Quintela <=