From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756259AbaIQRYT (ORCPT ); Wed, 17 Sep 2014 13:24:19 -0400 Received: from tetsuo.zabbo.net ([50.193.208.193]:47371 "EHLO tetsuo.zabbo.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755232AbaIQRYS (ORCPT ); Wed, 17 Sep 2014 13:24:18 -0400 Date: Wed, 17 Sep 2014 10:24:17 -0700 From: Zach Brown To: "Theodore Ts'o" , Milosz Tanski , LKML , Christoph Hellwig , "linux-fsdevel@vger.kernel.org" , linux-aio@kvack.org, Mel Gorman , Volker Lendecke , Tejun Heo , Jeff Moyer Subject: Re: [PATCH 2/7] Define new syscalls readv2,preadv2,writev2,pwritev2 Message-ID: <20140917172417.GD20887@lenny.home.zabbo.net> References: <057d758976db2fcce58e394abaa0d55e48cdeec1.1410810247.git.milosz@adfin.com> <20140917154327.GA12190@thunk.org> <20140917165930.GA24887@thunk.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140917165930.GA24887@thunk.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 17, 2014 at 12:59:30PM -0400, Theodore Ts'o wrote: > On Wed, Sep 17, 2014 at 12:05:23PM -0400, Milosz Tanski wrote: > > Theodore, > > > > I might be missing understanding something, but... I already omitted > > read2 and write2 which can be implemented in userspace by libc (as you > > pointed out). In the case of readv vs. preadv there's an extra > > positional argument (file offset) and preadv version doesn't change > > the file location. I didn't want to overload the meaning of preadv2 to > > take a special negative offset value that uses the current file > > position but also changes the file position. > > off_t has to be signed, so having a magic negative value doesn't > bother me that much. Or you could use a flag bitvalue which means to > use the fd's offset and to ignore the positional value. (More > bike-shedding :-) splice has already set the precedent for an optionally specified offset that falls back to the files's position. static long do_splice(struct file *in, loff_t __user *off_in, struct file *out, loff_t __user *off_out, size_t len, unsigned int flags) { ... if (off_out) { if (copy_from_user(&offset, off_out, sizeof(loff_t))) return -EFAULT; } else { offset = out->f_pos; } ... if (!off_out) out->f_pos = offset; else if (copy_to_user(off_out, &offset, sizeof(loff_t))) ret = -EFAULT; It's nice and simple and lets you update the user's offset. > So the suggestion was one of trying to (probably fruitlessly) trying > to stem the expnoential increase in read/write system calls. :-) I support this windmill tilting :). - z