From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konstantin Khlebnikov Subject: Re: [PATCH 1/2 V2] kvm tools: Add scatter-gather variants of IO functions Date: Sun, 17 Apr 2011 14:34:58 +0400 Message-ID: <4DAAC252.8050703@parallels.com> 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> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed 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: Sasha Levin Return-path: Received: from relay.parallels.com ([195.214.232.42]:57289 "EHLO relay.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752112Ab1DQKfB (ORCPT ); Sun, 17 Apr 2011 06:35:01 -0400 In-Reply-To: <1303035738.3017.5.camel@stimpy> Sender: kvm-owner@vger.kernel.org List-ID: 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.