qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 9/9] coalesce adjacent iovecs


From: Juan Quintela
Subject: Re: [Qemu-devel] [PATCH v3 9/9] coalesce adjacent iovecs
Date: Thu, 21 Mar 2013 18:41:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

Orit Wasserman <address@hidden> wrote:
> This way we send one big buffer instead of many small ones
>
> Signed-off-by: Orit Wasserman <address@hidden>
> ---
>  savevm.c | 21 +++++++++++++++++----
>  1 file changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/savevm.c b/savevm.c
> index 50e8fb2..13a533b 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -634,8 +634,14 @@ void qemu_put_buffer_no_copy(QEMUFile *f, const uint8_t 
> *buf, int size)
>          abort();
>      }
>  
> -    f->iov[f->iovcnt].iov_base = (uint8_t *)buf;
> -    f->iov[f->iovcnt++].iov_len = size;


> +    /* check for adjoint buffer and colace them */

s/colace/coalesce/

> +    if (f->iovcnt > 0 && buf == f->iov[f->iovcnt - 1].iov_base +
> +        f->iov[f->iovcnt - 1].iov_len) {
> +        f->iov[f->iovcnt - 1].iov_len += size;
> +    } else {
> +        f->iov[f->iovcnt].iov_base = (uint8_t *)buf;
> +        f->iov[f->iovcnt++].iov_len = size;
> +    }

Can we create a function for this?
Would help make sure that we don't forget to "fix" both places when we
have changes.

Later, Juan.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]