From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIjUS-0006Wy-VK for qemu-devel@nongnu.org; Thu, 21 Mar 2013 13:41:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIjUM-0001eh-5E for qemu-devel@nongnu.org; Thu, 21 Mar 2013 13:41:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61764) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIjUL-0001eS-UU for qemu-devel@nongnu.org; Thu, 21 Mar 2013 13:41:18 -0400 From: Juan Quintela In-Reply-To: <1363881940-27505-10-git-send-email-owasserm@redhat.com> (Orit Wasserman's message of "Thu, 21 Mar 2013 18:05:40 +0200") References: <1363881940-27505-1-git-send-email-owasserm@redhat.com> <1363881940-27505-10-git-send-email-owasserm@redhat.com> Date: Thu, 21 Mar 2013 18:41:23 +0100 Message-ID: <87fvzops58.fsf@elfo.elfo> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v3 9/9] coalesce adjacent iovecs Reply-To: quintela@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Orit Wasserman Cc: pbonzini@redhat.com, chegu_vinod@hp.com, qemu-devel@nongnu.org, mst@redhat.com Orit Wasserman wrote: > This way we send one big buffer instead of many small ones > > Signed-off-by: Orit Wasserman > --- > 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.