Patchwork [09/41] migration: flush all data to fd when buffered_flush is called

login
register
mail settings
Submitter Paolo Bonzini
Date Feb. 15, 2013, 5:46 p.m.
Message ID <1360950433-17106-10-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/220785/
State New
Headers show

Comments

Paolo Bonzini - Feb. 15, 2013, 5:46 p.m.
Including data that resided in the QEMUFile's own buffer.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 migration.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Orit Wasserman - Feb. 18, 2013, 9:26 a.m.
On 02/15/2013 07:46 PM, Paolo Bonzini wrote:
> Including data that resided in the QEMUFile's own buffer.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  migration.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/migration.c b/migration.c
> index 0f3cb5d..609bd7c 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -525,6 +525,8 @@ static ssize_t buffered_flush(MigrationState *s)
>  
>      DPRINTF("flushing %zu byte(s) of data\n", s->buffer_size);
>  
> +    qemu_fflush(s->file);
> +
>      while (s->bytes_xfer < s->xfer_limit && offset < s->buffer_size) {
>          size_t to_send = MIN(s->buffer_size - offset, s->xfer_limit - s->bytes_xfer);
>          ret = migrate_fd_put_buffer(s, s->buffer + offset, to_send);
> 
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Juan Quintela - Feb. 22, 2013, 10:42 a.m.
Paolo Bonzini <pbonzini@redhat.com> wrote:
> Including data that resided in the QEMUFile's own buffer.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Juan Quintela <quintela@redhat.com>

Patch

diff --git a/migration.c b/migration.c
index 0f3cb5d..609bd7c 100644
--- a/migration.c
+++ b/migration.c
@@ -525,6 +525,8 @@  static ssize_t buffered_flush(MigrationState *s)
 
     DPRINTF("flushing %zu byte(s) of data\n", s->buffer_size);
 
+    qemu_fflush(s->file);
+
     while (s->bytes_xfer < s->xfer_limit && offset < s->buffer_size) {
         size_t to_send = MIN(s->buffer_size - offset, s->xfer_limit - s->bytes_xfer);
         ret = migrate_fd_put_buffer(s, s->buffer + offset, to_send);