From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Subject: Re: [PATCH 1/2 V2] kvm tools: Add scatter-gather variants of IO functions Date: Sun, 17 Apr 2011 14:11:57 +0300 Message-ID: <1303038717.3017.18.camel@stimpy> References: <1302966356-13145-1-git-send-email-levinsasha928@gmail.com> <4DA9E285.5040308@openvz.org> <4DAAB0A3.3020206@redhat.com> <4DAABAF2.1020700@parallels.com> <1303035738.3017.5.camel@stimpy> <4DAAC252.8050703@parallels.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Avi Kivity , "penberg@kernel.org" , "mingo@elte.hu" , "asias.hejun@gmail.com" , "gorcunov@gmail.com" , "kvm@vger.kernel.org" To: Konstantin Khlebnikov Return-path: Received: from mail-ww0-f44.google.com ([74.125.82.44]:60190 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759556Ab1DQLML (ORCPT ); Sun, 17 Apr 2011 07:12:11 -0400 Received: by wwa36 with SMTP id 36so4638361wwa.1 for ; Sun, 17 Apr 2011 04:12:10 -0700 (PDT) In-Reply-To: <4DAAC252.8050703@parallels.com> Sender: kvm-owner@vger.kernel.org List-ID: On Sun, 2011-04-17 at 14:34 +0400, Konstantin Khlebnikov wrote: > Sasha Levin wrote: > > On Sun, 2011-04-17 at 14:03 +0400, Konstantin Khlebnikov wrote: > >> Avi Kivity wrote: > >>> What if nr is nonzero when the loop terminates? You need to update the > >>> first iovec entry so you don't redo that segment. > >> > >> Oh yes, it is simple (hunk above), so "const" from prototype must be removed, > >> while original syscalls declare iov argument as const. > > > > The problem here is that if we start changing the internals of the iovec > > struct it forces us to copy it before calling the I/O functions since if > > we change it within the functions it's unusable to the caller anymore. > > > > Currently it's passed as a const because we only move pointers outside > > the struct. > > > > Basically the trade-off here is copying iovec before every read/write vs > > having to sometimes read data again (< 1 block), so I've went with the > > latter. > > > > Do you think it's better to go with the first alternative? > > > > > > Or we can call one non-vectored operation for the rest of last io-verctor. I don't think it's worth delaying the next readv() to run through read_in_full, and whats more, the part we're going to read again is probably sitting in the file cache anyway. -- Sasha.