diff mbox series

[1/2] migration/qemu-file: remove check on writev_buffer in qemu_put_compression_data

Message ID 20190731144225.3784-2-richardw.yang@linux.intel.com
State New
Headers show
Series migration/qemu-file: cleanup and refine qemu-file | expand

Commit Message

Wei Yang July 31, 2019, 2:42 p.m. UTC
The check of writev_buffer is in qemu_fflush, which means it is not
harmful if it is NULL.

And removing it will make the code consistent since all other
add_to_iovec() is called without the check.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
---
 migration/qemu-file.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Dr. David Alan Gilbert Aug. 23, 2019, 10:30 a.m. UTC | #1
* Wei Yang (richardw.yang@linux.intel.com) wrote:
> The check of writev_buffer is in qemu_fflush, which means it is not
> harmful if it is NULL.
> 
> And removing it will make the code consistent since all other
> add_to_iovec() is called without the check.
> 
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>

So I think the real reason here is commit 11808bb  which removed
support for non-iovec writers.


Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  migration/qemu-file.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/migration/qemu-file.c b/migration/qemu-file.c
> index 0431585502..35c22605dd 100644
> --- a/migration/qemu-file.c
> +++ b/migration/qemu-file.c
> @@ -717,9 +717,7 @@ ssize_t qemu_put_compression_data(QEMUFile *f, z_stream *stream,
>      }
>  
>      qemu_put_be32(f, blen);
> -    if (f->ops->writev_buffer) {
> -        add_to_iovec(f, f->buf + f->buf_index, blen, false);
> -    }
> +    add_to_iovec(f, f->buf + f->buf_index, blen, false);
>      f->buf_index += blen;
>      if (f->buf_index == IO_BUF_SIZE) {
>          qemu_fflush(f);
> -- 
> 2.17.1
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
diff mbox series

Patch

diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index 0431585502..35c22605dd 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -717,9 +717,7 @@  ssize_t qemu_put_compression_data(QEMUFile *f, z_stream *stream,
     }
 
     qemu_put_be32(f, blen);
-    if (f->ops->writev_buffer) {
-        add_to_iovec(f, f->buf + f->buf_index, blen, false);
-    }
+    add_to_iovec(f, f->buf + f->buf_index, blen, false);
     f->buf_index += blen;
     if (f->buf_index == IO_BUF_SIZE) {
         qemu_fflush(f);