[PATCH v2 12/24] migration/colo: Send device states without copying buffer

Peter Xu posted 24 patches 1 week, 5 days ago
Maintainers: Hailiang Zhang <zhanghailiang@xfusion.com>, Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>, Markus Armbruster <armbru@redhat.com>
[PATCH v2 12/24] migration/colo: Send device states without copying buffer
Posted by Peter Xu 1 week, 5 days ago
We can safely use the async version of put buffer here because the qemufile
will be flushed right away.

Suggested-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
 migration/colo.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/migration/colo.c b/migration/colo.c
index 1b94e0f0ee..0b1a58cd8f 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -486,7 +486,8 @@ static int colo_do_checkpoint_transaction(MigrationState *s,
         goto out;
     }
 
-    qemu_put_buffer(s->to_dst_file, bioc->data, bioc->usage);
+    /* We can use async put because flush happens right away */
+    qemu_put_buffer_async(s->to_dst_file, bioc->data, bioc->usage, false);
     ret = qemu_fflush(s->to_dst_file);
     if (ret < 0) {
         goto out;
-- 
2.50.1
Re: [PATCH v2 12/24] migration/colo: Send device states without copying buffer
Posted by Fabiano Rosas 1 week, 5 days ago
Peter Xu <peterx@redhat.com> writes:

> We can safely use the async version of put buffer here because the qemufile
> will be flushed right away.
>
> Suggested-by: Fabiano Rosas <farosas@suse.de>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  migration/colo.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/migration/colo.c b/migration/colo.c
> index 1b94e0f0ee..0b1a58cd8f 100644
> --- a/migration/colo.c
> +++ b/migration/colo.c
> @@ -486,7 +486,8 @@ static int colo_do_checkpoint_transaction(MigrationState *s,
>          goto out;
>      }
>  
> -    qemu_put_buffer(s->to_dst_file, bioc->data, bioc->usage);
> +    /* We can use async put because flush happens right away */
> +    qemu_put_buffer_async(s->to_dst_file, bioc->data, bioc->usage, false);
>      ret = qemu_fflush(s->to_dst_file);
>      if (ret < 0) {
>          goto out;

Reviewed-by: Fabiano Rosas <farosas@suse.de>