From patchwork Sat May 20 00:00:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13249010 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 BCAD8C7EE23 for ; Sat, 20 May 2023 00:02:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C3A86280016; Fri, 19 May 2023 20:02:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BBEB7280001; Fri, 19 May 2023 20:02:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 99BE9280016; Fri, 19 May 2023 20:02:30 -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 7D758280001 for ; Fri, 19 May 2023 20:02:30 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 4E6EF140B07 for ; Sat, 20 May 2023 00:02:30 +0000 (UTC) X-FDA: 80808681660.30.1429408 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf07.hostedemail.com (Postfix) with ESMTP id 7AE9E40021 for ; Sat, 20 May 2023 00:02:28 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=cUImny7l; spf=pass (imf07.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684540948; 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=rmUg21oqbgLRKa8Xmc9rYZI7yR2ltYVW2UHU8B7zCB0=; b=jZ5VSintkiR91ZVFmn1M1gWoLei9ZslC0ulTlim9uXcoc3leEJY9//O1RPdW7Wert/eurN T8h7of0jPLkuUNOkiKX4ypjZT+Y/BnJu8sr52r3WCRBIyJW+cWgLTOdZTfdvqf2GfMlP4Z 1vVxHPUV3q1OnFIb9Gm/aAvTcOvf8Lw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684540948; a=rsa-sha256; cv=none; b=RF9eyJ6zEUlduSI99UWBde6TMYa9x8VwSC88kqy5IYl/Q5XF8aAWozSzZEW/lTUcIRZz6c 0Edtvkm3KbvynWhYe5coetAet4VnZnzeyhrgD2WKtPB8yFKFxmidBiyUWJL8dbPySm0Dbe DtZlhzOah1AjVCHqVOpYpMiknFuuaBw= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=cUImny7l; spf=pass (imf07.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684540947; 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=rmUg21oqbgLRKa8Xmc9rYZI7yR2ltYVW2UHU8B7zCB0=; b=cUImny7lzYiVC2HTPe25U2MbIqLkacpwMDuYakT/FPuLGjsq6Bl9zcJWClhLokqv94Gwib jpovP+4ORLfZk5XC5xSJFUHcFk6aL60vsfoZo2JJMITPQhqTdTWDGgRZcP6jo1YX++CY5s tjUUwKDjCew2Y0t1yf3r2iUCuVlOurE= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-416-JpVDmfLpP9q6slSFpg2Hww-1; Fri, 19 May 2023 20:02:24 -0400 X-MC-Unique: JpVDmfLpP9q6slSFpg2Hww-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6209238035AA; Sat, 20 May 2023 00:02:23 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB668492B0A; Sat, 20 May 2023 00:02:20 +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 v21 29/30] splice: Remove generic_file_splice_read() Date: Sat, 20 May 2023 01:00:48 +0100 Message-Id: <20230520000049.2226926-30-dhowells@redhat.com> In-Reply-To: <20230520000049.2226926-1-dhowells@redhat.com> References: <20230520000049.2226926-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Rspamd-Queue-Id: 7AE9E40021 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: btinqjpdynua94gpu4eaqazcayrtfk6t X-HE-Tag: 1684540948-762135 X-HE-Meta: U2FsdGVkX19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piu5bTKdT1ed0X7Vgwn1lg4LkMmh4Y7zGE5/NhlqHba1NLY3X1wLSCYaeKaccubjalvBS2qgUkukufOAlslGvxJSQAbYsy6S8s82mHde0k44NgqMt+xpBPoL738HIGrCn6zv8toqLNneGf+WGVO7Bf0jiebqyQAtX4COKTlBxvyFVdhL9DrqwKU+viR5a72H93D8jdXNOQA4MX1JqP4XgONGQKhbi0slngYfQweZ7us3crI1CiKtSlfR+OzOL6mnYSa6KoZ2gFIKQoKWhN1Eiax9j618N6+Nqs+x6CmySyoEAR4WVv1HutI+V6NN6ljN/ArFmMqCJqhcVvUFKOr2pH00TeuMNyST+z 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 cc: Christoph Hellwig 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 Reviewed-by: Christoph Hellwig Reviewed-by: Christian Brauner --- 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,