From patchwork Fri May 19 07:40:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13247780 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 32F2EC7EE2D for ; Fri, 19 May 2023 07:42:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C22BD900021; Fri, 19 May 2023 03:42:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BAAD2900003; Fri, 19 May 2023 03:42:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A4997900021; Fri, 19 May 2023 03:42:34 -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 913CB900003 for ; Fri, 19 May 2023 03:42:34 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 6C2D2409CA for ; Fri, 19 May 2023 07:42:34 +0000 (UTC) X-FDA: 80806212228.29.1B6FD15 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf19.hostedemail.com (Postfix) with ESMTP id B67771A0014 for ; Fri, 19 May 2023 07:42:31 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ijTF70p8; spf=pass (imf19.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.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=1684482151; 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=g1kSgt8JtA0JiFV4X1i6k/i3VuOpNNHzBh5elSR8Nt8=; b=EDwGi4rANtYSMuHMBBWtzVt2lZ2hNLYB4YgMHzWKLocBbd7MMSVREPjKnpiPDsIZGHqx4/ eU1/lQxOY9zNUsqnA/osf/OEiCIJBVYWe3IHhony1JTAW3636ezMWBXS3iSTp8QX1DPvjx PUKtGcbjS9ZwpLTOtn9y2GNB4a5/Nkk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684482151; a=rsa-sha256; cv=none; b=GDyL9NvpBgltnpTwsPHiyQJ7R0lECPlKhcxRKiGoOf57RmsrFnKBuU4NJnRGhR35NRlATO XDWlRaaMOosjz3jmrScxdLaef/qYaTgpsfLElXjw4bDyYfAefe9FngyDOKJ/WP/ms/0lmO GAFTCRUj9iRJSVXJyyCQJelMRo9UDUY= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ijTF70p8; spf=pass (imf19.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.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=1684482151; 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=g1kSgt8JtA0JiFV4X1i6k/i3VuOpNNHzBh5elSR8Nt8=; b=ijTF70p85j7rirTh/SBjTp6GYNtEhFIBQGVLBrKeTonACIQ/y8sXhWsdtjOT/3qYQePq7/ DjLMcM4L7r8mtsrl/P/3fqO4dSxYS1isKeVJsaOJNytRJcpvAD9Zhk37VcV8zLhYmj/b6E WfYUwTeh+1qWDQYXnLcMhxcZVZaSROY= 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-189-_2ymUi_4PoOAUMbTHfhg_A-1; Fri, 19 May 2023 03:42:27 -0400 X-MC-Unique: _2ymUi_4PoOAUMbTHfhg_A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AAB49101A55C; Fri, 19 May 2023 07:42:26 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1D994C0004B; Fri, 19 May 2023 07:42:23 +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 v20 25/32] cifs: Use generic_file_splice_read() Date: Fri, 19 May 2023 08:40:40 +0100 Message-Id: <20230519074047.1739879-26-dhowells@redhat.com> In-Reply-To: <20230519074047.1739879-1-dhowells@redhat.com> References: <20230519074047.1739879-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Rspamd-Queue-Id: B67771A0014 X-Rspam-User: X-Stat-Signature: uaz5kucnerwnyerb6i9c7mq36dy8hy95 X-Rspamd-Server: rspam03 X-HE-Tag: 1684482151-218986 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2XuoK+OyYEtwCW9G/ZinDQ8SgCvX2W1PAZDefv0uN6FOENH3mYSSkP6L/usWSJPr1/VkASwLmxOc07Vid4A3DlTerzzeX3aAUCY7Hc0pZ8l53pVv6aj7Zk3/FD2HihBaZvSSGGBhM7ecV3LI+3fBpJ+HEbGPFHz1tG+j6Fvm8CSuMA84uoDNrPREbAYdGsGMh005rznJxLH2y8t5XfS9g91whCDAQmUuWaGnVqC77ZY7COIMHSh6yhpBoJlPpGqQ9qtx5RvHGmZ3VnUq5+eecq/MwRHwugKx//Y84u1bfQV1hyVXIRWBjEDb/5VWlbVbihZ1abNnLOvoelgZEzjSdDhSqbbQvRM6JYh6pj+lCVJQhjjsJpMlqTTAcinTKMHqUeRz0IEutCyQjMOE+n/XHAAxFhLMKHvbQZ3Wkt7QFgAI1O0zI+bdLT5 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 generic_file_splice_read() rather than doing it for itself. 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 #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 43a4d8603db3..257587a6cade 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 = generic_file_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 = generic_file_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 = generic_file_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 = generic_file_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 c5fcefdfd797..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 direct_splice_read(in, ppos, pipe, len, flags); - return filemap_splice_read(in, ppos, pipe, len, flags); -}