Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1647088rwr; Thu, 20 Apr 2023 19:34:46 -0700 (PDT) X-Google-Smtp-Source: AKy350a0iXAjO5o5Zm7bpHjDTPmbZtPrygwTr13DOumOpshRpMpISgkdZnH8K5LKYWVYRy5r74Zm X-Received: by 2002:a05:6a21:998d:b0:f1:ff77:4a32 with SMTP id ve13-20020a056a21998d00b000f1ff774a32mr5153406pzb.9.1682044486445; Thu, 20 Apr 2023 19:34:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682044486; cv=none; d=google.com; s=arc-20160816; b=OLVO94T57WhDK/cxUaQod+WDShg0+GiLIEb91PO7vS+SfTkCuNoaDsO/AmeLqFjItT hTZ3otduzhxcgO3/7DF/O/wkZLhgtiJu4lClXSnXTjOuEwOLE/pxOgqufujZ4KWoAS6T J3uAus/743dNtdfO/4bRpXsB7vRHsTiUJgmhCqRNZqKza16AnNrHf7aL6UJABIb7oUUu s2gxa2ubjaZs0pISuP8ADj03JUIbJrN/u/peW/XWJ6JEOceqJu9yLBtwU+SYDXS3/pB0 k42rC4JuYCq8kGI3q6+aWwnvRQHoN31plNsyL1oW6mwQVSdZW36QyaHi8HxirMLxB6ym GlrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Y1bbQJ7Lqx3xWtWj+CoARcsmEeD4ylMi8y4fbkOFWk8=; b=yWDcE+iD/J8SXVaFMFnpAtD0wymAoZnnWQQf9kd2cG/GoIITwKTeN0TNBJxWTX1onY zDemyWWKGjDV7z+CnfUGmYmxrXQvS2Z/xDScouWceHq+P2sc1RJ4F1s9cIqSJoRVDEFS mBD5PLz1ws0rE19VnnBO/S7vpSkxT2r5f91gPFJ2A5Qg+LrxkFGDINPq1xTPd8bmhmxg LuyrVMfpXa9sAt0Tq0cdQpx3yO2pTs4lSsW5phKEi/mN3YzhecFvyRnt8k7lqWHbcLoK +Z6w21rKA92/TD1dwTcVjNIJylvgvG1Izv6jCgHd0ImwXECKh1CYjJoLGal/quj+QyNA qirg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=DeFQt246; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d9-20020a631d09000000b004fb97a4c536si3257124pgd.873.2023.04.20.19.34.29; Thu, 20 Apr 2023 19:34:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=DeFQt246; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233501AbjDUCZy (ORCPT + 99 others); Thu, 20 Apr 2023 22:25:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233317AbjDUCZv (ORCPT ); Thu, 20 Apr 2023 22:25:51 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E2033C34; Thu, 20 Apr 2023 19:25:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Y1bbQJ7Lqx3xWtWj+CoARcsmEeD4ylMi8y4fbkOFWk8=; b=DeFQt246yzDgknT7FPn5/XxNHH GbHy6KiFEA5Tpu+HGgzHFmYW6agusVPC+Emv9k35KuYlk5KaiTns4veWfFAMpD02EDxICWXt7Lb3P mOgDGDx7nXcayyFH1e4C79FDwu6xJ7chrQsyQWIr+ZQVvfAyNxzqS8P6Hd4CxEU9k7XIY7l1BriHu kL0LJluVR6A8lXvQWSoZI3TJAEZJcr0ySA7Y0mSYO+KpSzZYiUXKVg39tQa7RV7W6URmB51nn/SCp 2WvIch7hLU6utswkEYV/li0kV+NUdjYJSP/EsUGZL660FCkOw55v6kmA5GxGStfVseujlNodizJbk gki8B+Mw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1ppgSj-00B37o-1L; Fri, 21 Apr 2023 02:25:25 +0000 Date: Fri, 21 Apr 2023 03:25:25 +0100 From: Al Viro To: David Howells Cc: Jens Axboe , Christoph Hellwig , Matthew Wilcox , Jan Kara , Jeff Layton , David Hildenbrand , Jason Gunthorpe , Logan Gunthorpe , Hillf Danton , Christian Brauner , Linus Torvalds , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Christoph Hellwig , John Hubbard Subject: Re: [PATCH v18 09/15] iov_iter: Kill ITER_PIPE Message-ID: <20230421022525.GX3390869@ZenIV> References: <20230314220757.3827941-1-dhowells@redhat.com> <20230314220757.3827941-10-dhowells@redhat.com> <20230420222231.GT3390869@ZenIV> <20230420223657.GV3390869@ZenIV> <20230421011145.GW3390869@ZenIV> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230421011145.GW3390869@ZenIV> Sender: Al Viro X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 21, 2023 at 02:11:45AM +0100, Al Viro wrote: > On Thu, Apr 20, 2023 at 11:36:57PM +0100, Al Viro wrote: > > > Don't get me wrong - I'd love to kill ITER_PIPE off; it's just that tons > > of ->splice_read() duplicating the corresponding ->read_iter() up to the > > point where it would call generic_file_read_iter(), modulo ignoring > > O_DIRECT case and then calling filemap_splice_read() instead... Painful > > and asking for trouble down the road. > > FWIW, broken in this series: > * a bunch of 9p variants (those could probably switch to direct) > * afs > * ceph (very likely) > * ecryptfs (atime propagation) > * dax on various filesystems (probably) > * f2fs > * gfs2 > * nfs > * ocfs2 > * orangefs > * xfs > * zonefs (probably) > * splice from UDP sockets, unless I'm misreading something. > Your sock_splice_read() still falls back to generic_file_splice_read(), > rather than to direct_splice_read() and sockets don't have O_DIRECT > in flags. Neither do they have associated page cache ;-) > > Sure, we could provide a bunch of ->splice_read(), but then we'd have to make > sure that all subsequent changes to matching ->read_iter() get duplicated - > unless they are on O_DIRECT-only paths, that is... OK, how about the following modification of ITER_PIPE? * buffers might extend past the current position * buffers (as now) are either data or zero-copy ones. * advance past the end of data => allocate data-type buffers and fill with zeroes. * copying data to area prior to the end of buffers => each zero-copy-type buffer is converted to a data one; data is copied, but WTF else can you do? If there's a page borrowed from page cache, we can't change its contents anyway. * zero-copy of a page into an area overlapping the existing buffers => treat as data copy for the overlapping part and zero-copy the rest (if any) in normal fashion. * iov_iter_get_pages(): convert everything involved into data-type buffers first, then give caller references to that. Zero-fill new pages (if any). * iov_iter_revert() does *NOT* truncate anything * truncation of stuff past the current position is done by generic_file_splice_read() not only in error case, but on success as well - starting at the end of actually read data, of course. That would make for seekable ITER_PIPE, with zero-copy working for normal cases. I agree that O_DIRECT would probably be better off with ITER_BVEC. Comments?