From patchwork Mon May 22 13:50:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13250609 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A405C7EE29 for ; Mon, 22 May 2023 13:52:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C1F0890000D; Mon, 22 May 2023 09:52:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BCF83900009; Mon, 22 May 2023 09:52:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A973190000D; Mon, 22 May 2023 09:52:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 993D7900009 for ; Mon, 22 May 2023 09:52:27 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 23A07402E4 for ; Mon, 22 May 2023 13:52:27 +0000 (UTC) X-FDA: 80818030734.14.C9645BF Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf25.hostedemail.com (Postfix) with ESMTP id 5C247A0018 for ; Mon, 22 May 2023 13:52:25 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=SUcVZbm3; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf25.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684763545; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=sPgb6iT0KyhUHD55wBvrfISNeJ76P+kmnyDDc2IZvro=; b=bu4Tc1xm4NeR9DyRrSyXcWnlH0ebsXMc9ZlY8ZS7/FWDNxj1S25PDEfd0SwZdvNk/Pvunn bNKrBg5O4VymaXfAg2Guf5Fa+Wbo8LJUYwhAJ7Y5itAyzalbJ9PDIQPFuYiuUxaag3BiAV LX8WKfDDbots3ZNtGC+gKpC2Pc22e9w= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=SUcVZbm3; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf25.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684763545; a=rsa-sha256; cv=none; b=XUyfpG7P9eZOyNX+z47EQyus1uC3xsKuvFuXbiwf5yZEoVfT5h31ZRWXoz205V3ssMDvg9 JHpAWO2kCO5AHkRIKenJ+H6Bjbc/MK0HYW5lMuZKFaPfZFZF1geFHsJuxNKVOt9D3KTxqx tw9+rWv71Gxvrz33yTQVzh7OAksqnR0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684763544; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sPgb6iT0KyhUHD55wBvrfISNeJ76P+kmnyDDc2IZvro=; b=SUcVZbm3csF7nglSD9jDqJIUoW5qxRRJBE+L7YWGEVPx9l5Zrd6n0QxQAZJf+/RbJJ+1q3 Kc3fGfgn5vrDZECiP2WaIU5JWcKZM7d42P+pD0Xehi4ndOOPlaB4YMRxar2I36pOB3Dq5N OTUtIzv6XNFV11WG9lX/Kc4XetkTDRw= 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-195-wzCHOXg9PImMcHZvn4QAHg-1; Mon, 22 May 2023 09:52:19 -0400 X-MC-Unique: wzCHOXg9PImMcHZvn4QAHg-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 CB97D8032F5; Mon, 22 May 2023 13:52:17 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.39.192.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A30C40CFD45; Mon, 22 May 2023 13:52:14 +0000 (UTC) From: David Howells To: Jens Axboe , Al Viro , Christoph Hellwig Cc: David Howells , 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 , Steve French , John Hubbard , linux-cifs@vger.kernel.org Subject: [PATCH v22 29/31] splice: Remove generic_file_splice_read() Date: Mon, 22 May 2023 14:50:16 +0100 Message-Id: <20230522135018.2742245-30-dhowells@redhat.com> In-Reply-To: <20230522135018.2742245-1-dhowells@redhat.com> References: <20230522135018.2742245-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 5C247A0018 X-Stat-Signature: tpjea945dikmof6cfgwte9y7j159uygk X-Rspam-User: X-HE-Tag: 1684763545-192815 X-HE-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xJSEprZPW7hzEye+Txbx8ZvpN8pGeq3VCoZyndbhGhODxfDrbnQJUEZ+eaJ9WNTWrsKRLnmmWAbIAnEvmSEKOKX2LRo70pAF/1K/RUxybTfW19Ao/X9LK7ZYiytdhwf89w6TabjLGOUUUr7h0BnbhWv8IH/8Mhw6cduysPZV+vT7ss2JcJmo56HliXMY02+H5xQZG3b3dmz30jmicv+ws+zy47D6vOTKidkPQNFOAcDPaPy04Ac1yVyPQkGXDsRiiQR3wdFq0B0ApD2aKKUJsbhYAwhcJ6ycMF1QIBXvY9FNtBTVMg7Ji9tkee7mFZnpSHWex6e//lworsnlWjtGtOmNgCpxMlv+ezS5He7bHSMK0BqfVEVQC3DYz/aojursdS X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Remove generic_file_splice_read() as it has been replaced with calls to filemap_splice_read() and copy_splice_read(). With this, ITER_PIPE is no longer used. Signed-off-by: David Howells Reviewed-by: Christoph Hellwig Reviewed-by: Christian Brauner cc: Jens Axboe cc: Steve French cc: Al Viro cc: David Hildenbrand cc: John Hubbard cc: linux-mm@kvack.org cc: linux-block@vger.kernel.org cc: linux-cifs@vger.kernel.org cc: linux-fsdevel@vger.kernel.org --- Notes: ver #21) - Move zero-len check to vfs_splice_read(). - Move s_maxbytes check to filemap_splice_read(). - DIO (and DAX) are handled by vfs_splice_read(). ver #20) - Use s_maxbytes from the backing store (in->f_mapping), not the front inode (especially for a blockdev). ver #18) - Split out the change to cifs to make it use generic_file_splice_read(). - Split out the unexport of filemap_splice_read() (still needed by cifs). fs/splice.c | 43 ------------------------------------------- include/linux/fs.h | 2 -- 2 files changed, 45 deletions(-) diff --git a/fs/splice.c b/fs/splice.c index 8268248df3a9..9be4cb3b9879 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -386,49 +386,6 @@ ssize_t copy_splice_read(struct file *in, loff_t *ppos, } EXPORT_SYMBOL(copy_splice_read); -/** - * generic_file_splice_read - splice data from file to a pipe - * @in: file to splice from - * @ppos: position in @in - * @pipe: pipe to splice to - * @len: number of bytes to splice - * @flags: splice modifier flags - * - * Description: - * Will read pages from given file and fill them into a pipe. Can be - * used as long as it has more or less sane ->read_iter(). - * - */ -ssize_t generic_file_splice_read(struct file *in, loff_t *ppos, - struct pipe_inode_info *pipe, size_t len, - unsigned int flags) -{ - struct iov_iter to; - struct kiocb kiocb; - int ret; - - iov_iter_pipe(&to, ITER_DEST, pipe, len); - init_sync_kiocb(&kiocb, in); - kiocb.ki_pos = *ppos; - ret = call_read_iter(in, &kiocb, &to); - if (ret > 0) { - *ppos = kiocb.ki_pos; - file_accessed(in); - } else if (ret < 0) { - /* free what was emitted */ - pipe_discard_from(pipe, to.start_head); - /* - * callers of ->splice_read() expect -EAGAIN on - * "can't put anything in there", rather than -EFAULT. - */ - if (ret == -EFAULT) - ret = -EAGAIN; - } - - return ret; -} -EXPORT_SYMBOL(generic_file_splice_read); - const struct pipe_buf_operations default_pipe_buf_ops = { .release = generic_pipe_buf_release, .try_steal = generic_pipe_buf_try_steal, diff --git a/include/linux/fs.h b/include/linux/fs.h index e3c22efa413e..08ba2ae1d3ce 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2755,8 +2755,6 @@ ssize_t filemap_splice_read(struct file *in, loff_t *ppos, ssize_t copy_splice_read(struct file *in, loff_t *ppos, struct pipe_inode_info *pipe, size_t len, unsigned int flags); -extern ssize_t generic_file_splice_read(struct file *, loff_t *, - struct pipe_inode_info *, size_t, unsigned int); extern ssize_t iter_file_splice_write(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe,