From patchwork Sat May 20 00:00:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13249008 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 4A18CC7EE23 for ; Sat, 20 May 2023 00:02:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 99E73280014; Fri, 19 May 2023 20:02:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 92889280001; Fri, 19 May 2023 20:02:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 779E5280014; Fri, 19 May 2023 20:02:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 5F348280001 for ; Fri, 19 May 2023 20:02:26 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3CA4AAE538 for ; Sat, 20 May 2023 00:02:26 +0000 (UTC) X-FDA: 80808681492.17.44EC7E9 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf08.hostedemail.com (Postfix) with ESMTP id 758C716001D for ; Sat, 20 May 2023 00:02:24 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ea8kMN8G; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf08.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=1684540944; 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=KS9sZ9kcl+UmAh/rrU1AUBhdO0vlEMJjBaa07cCJK5s=; b=SMTA84HFPYiqnuNNEGSDsHRTH+ztDkjRQJzjxDtb0AMqHDGvBfiHbuKgdCKotsB+jeZPrE wmjr0G7TKbJ46kAMRPhgmA55HiC83VEm3DIQ6sXmdj0LLuDco6/Xd2FG3beakb2NoxNEfF jRn+WB4kEFYISGSd+JzLDJA4PJmNJ2k= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ea8kMN8G; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf08.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=1684540944; a=rsa-sha256; cv=none; b=avno6Qye05E9YIN/TfQUHbqjLhLL4NlJF9E39f3SkylJc4q8JW9r8S1Ni76ZIc0Xfe6tDP qKByXL1W1n6cKpCYzdCkodnaI7sNyFof3Jkn+K2OsrKSklSIHbWWeRHJUpReAoTUIgxllK zkCeFXsIQB9Nrlth5ELMJGLemMAz3OQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684540943; 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=KS9sZ9kcl+UmAh/rrU1AUBhdO0vlEMJjBaa07cCJK5s=; b=ea8kMN8GIV10ipsMAeiEnQW1pU88+Lv+f8CTzN4DeNtDxJgyad8j65J10ya4CC9I6kjRb6 TiBCKuw4QoKrm1HERuRj/Um6szVMyD4pRyA/OYu4In+NHm7oRChTmRSpMqrTSWaGBFv9bS lEYzs9fN9NfYikk8vYVkj3AVkAsvmrM= 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-231-r_htSqC2OBidCEEBrjvtAw-1; Fri, 19 May 2023 20:02:18 -0400 X-MC-Unique: r_htSqC2OBidCEEBrjvtAw-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 4832938035AA; Sat, 20 May 2023 00:02:17 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id C46A240CFD45; Sat, 20 May 2023 00:02: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 , Paulo Alcantara , Steve French , John Hubbard , linux-cifs@vger.kernel.org Subject: [PATCH v21 27/30] cifs: Use filemap_splice_read() Date: Sat, 20 May 2023 01:00:46 +0100 Message-Id: <20230520000049.2226926-28-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.1 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 758C716001D X-Stat-Signature: enmjp4f5q1e7wp9f9k6qkjkeza6w5uki X-HE-Tag: 1684540944-740107 X-HE-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RiHw6IdfNLPCdZ/6uJe6JtkLlUme7/GtorA/QIv87cLi4HQf5iFki14LEPC2qa5brbD5WUNUQD7Sv5QnVBjItzMIZmfPxmrAh7RuROZ5k0EAArojgD9SCbVkdlB6xnR4Eo4DP/OJC/iYYaWa+80yVMOsEjnl0hYgIvvZveAWtTsdBuKtSO9+QM6T9g4RdHkfhZe+YaxgdR3k8MX8BdjXWu9fmC83LxAO7JqOkt0oZ+L2n7t9EM0l+Ugm5i10M3AWDVUJJnrCakFe0aJc1PNA7qQxb1/gsln+paYg8e/3/H4E3fqCPBxbR9y5rt4GCmRjOv+Z64ZgAYltYZgF60DU7ywcslC5Oa7W9zZTJ5GZkZJ2JvKLNtcz7UgFPKP2gwSx5I3JiYgfJsRBMkZzKajIhbA4JkBuSR8TV+ 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: Make cifs use filemap_splice_read() rather than doing its own version of generic_file_splice_read(). Signed-off-by: David Howells Reviewed-by: Christoph Hellwig Reviewed-by: Paulo Alcantara (SUSE) 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) - Switch to filemap_splice_read() rather than generic_file_splice_read(). ver #20) - Don't remove the export of filemap_splice_read(). ver #18) - Split out from change to generic_file_splice_read(). fs/cifs/cifsfs.c | 8 ++++---- fs/cifs/cifsfs.h | 3 --- fs/cifs/file.c | 16 ---------------- 3 files changed, 4 insertions(+), 23 deletions(-) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index fa2477bbcc86..4f4492eb975f 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -1376,7 +1376,7 @@ const struct file_operations cifs_file_ops = { .fsync = cifs_fsync, .flush = cifs_flush, .mmap = cifs_file_mmap, - .splice_read = cifs_splice_read, + .splice_read = filemap_splice_read, .splice_write = iter_file_splice_write, .llseek = cifs_llseek, .unlocked_ioctl = cifs_ioctl, @@ -1396,7 +1396,7 @@ const struct file_operations cifs_file_strict_ops = { .fsync = cifs_strict_fsync, .flush = cifs_flush, .mmap = cifs_file_strict_mmap, - .splice_read = cifs_splice_read, + .splice_read = filemap_splice_read, .splice_write = iter_file_splice_write, .llseek = cifs_llseek, .unlocked_ioctl = cifs_ioctl, @@ -1434,7 +1434,7 @@ const struct file_operations cifs_file_nobrl_ops = { .fsync = cifs_fsync, .flush = cifs_flush, .mmap = cifs_file_mmap, - .splice_read = cifs_splice_read, + .splice_read = filemap_splice_read, .splice_write = iter_file_splice_write, .llseek = cifs_llseek, .unlocked_ioctl = cifs_ioctl, @@ -1452,7 +1452,7 @@ const struct file_operations cifs_file_strict_nobrl_ops = { .fsync = cifs_strict_fsync, .flush = cifs_flush, .mmap = cifs_file_strict_mmap, - .splice_read = cifs_splice_read, + .splice_read = filemap_splice_read, .splice_write = iter_file_splice_write, .llseek = cifs_llseek, .unlocked_ioctl = cifs_ioctl, diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 74cd6fafb33e..d7274eefc666 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h @@ -100,9 +100,6 @@ extern ssize_t cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to); extern ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from); extern ssize_t cifs_direct_writev(struct kiocb *iocb, struct iov_iter *from); extern ssize_t cifs_strict_writev(struct kiocb *iocb, struct iov_iter *from); -extern ssize_t cifs_splice_read(struct file *in, loff_t *ppos, - struct pipe_inode_info *pipe, size_t len, - unsigned int flags); extern int cifs_flock(struct file *pfile, int cmd, struct file_lock *plock); extern int cifs_lock(struct file *, int, struct file_lock *); extern int cifs_fsync(struct file *, loff_t, loff_t, int); diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 023496207c18..375a8037a3f3 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -5078,19 +5078,3 @@ const struct address_space_operations cifs_addr_ops_smallbuf = { .launder_folio = cifs_launder_folio, .migrate_folio = filemap_migrate_folio, }; - -/* - * Splice data from a file into a pipe. - */ -ssize_t cifs_splice_read(struct file *in, loff_t *ppos, - struct pipe_inode_info *pipe, size_t len, - unsigned int flags) -{ - if (unlikely(*ppos >= file_inode(in)->i_sb->s_maxbytes)) - return 0; - if (unlikely(!len)) - return 0; - if (in->f_flags & O_DIRECT) - return copy_splice_read(in, ppos, pipe, len, flags); - return filemap_splice_read(in, ppos, pipe, len, flags); -}