Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A10A7C678D5 for ; Wed, 8 Mar 2023 15:57:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232344AbjCHP5q (ORCPT ); Wed, 8 Mar 2023 10:57:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232329AbjCHP5S (ORCPT ); Wed, 8 Mar 2023 10:57:18 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93D70DC3B5 for ; Wed, 8 Mar 2023 07:55:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678290883; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vhkGR776MdfrN7s64zhXsYKAYFWiHFuXPp/BUnqkV7o=; b=LBiUkZciRkVD86MCGHKnXvjd5wblRQl4+GoW0SyyExsRanIEIKmnKj7bXa5ICMr1kAz255 i5sROTIGQkDyGpY6iZ77aWIqudI1/v8wI73Yas+XhRy8vrnGC0NjksKKOh3vH/OTBgx2FM W4ywG0hr+bL6+qm8G1lxEFmD/P/Z+dg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-509-pzA8nezuOzGg3yv_5nXINg-1; Wed, 08 Mar 2023 10:54:41 -0500 X-MC-Unique: pzA8nezuOzGg3yv_5nXINg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2B1AE85CCE0; Wed, 8 Mar 2023 15:54:40 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id B0246400DB36; Wed, 8 Mar 2023 15:54:36 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: References: <20230308143754.1976726-1-dhowells@redhat.com> <20230308143754.1976726-4-dhowells@redhat.com> To: Miklos Szeredi Cc: dhowells@redhat.com, Jens Axboe , Al Viro , Christoph Hellwig , Matthew Wilcox , Jan Kara , Jeff Layton , David Hildenbrand , Jason Gunthorpe , Logan Gunthorpe , Hillf Danton , 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 , linux-unionfs@vger.kernel.org Subject: Re: [PATCH v16 03/13] overlayfs: Implement splice-read MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2011734.1678290876.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Wed, 08 Mar 2023 15:54:36 +0000 Message-ID: <2011735.1678290876@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Miklos Szeredi wrote: > > + ret =3D -EINVAL; > > + if (!real.file->f_op->splice_read) > > + goto out_fdput; > > + > > + ret =3D rw_verify_area(READ, real.file, ppos, len); > > + if (unlikely(ret < 0)) > > + goto out_fdput; > > + > > + old_cred =3D ovl_override_creds(file_inode(in)->i_sb); > > + ret =3D real.file->f_op->splice_read(real.file, ppos, pipe, le= n, flags); > = > I don't think you replied to my suggestion of using a helper here. > E.g. it could be as simple as exporting do_splice_to(), or renaming it > to vfs_splice_read() to be more readable. It would remove the > boilerplate and be more robust if any changes are done to the splice > reading code. Using do_splice_to() as a helper is probably a good idea, though both Will= y and Christoph seem to dislike it. The pipe occupancy check has already been done, so I'm not sure if it shou= ld be repeated - though it probably wouldn't hurt. David