Message ID | 20230519074047.1739879-16-dhowells@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 15F4CC77B7A for <linux-mm@archiver.kernel.org>; Fri, 19 May 2023 07:42:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9FEAB900017; Fri, 19 May 2023 03:42:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 98D27900003; Fri, 19 May 2023 03:42:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8008A900017; Fri, 19 May 2023 03:42:01 -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 6F125900003 for <linux-mm@kvack.org>; Fri, 19 May 2023 03:42:01 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 4B384C0907 for <linux-mm@kvack.org>; Fri, 19 May 2023 07:42:01 +0000 (UTC) X-FDA: 80806210842.19.4F9BC7A Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf05.hostedemail.com (Postfix) with ESMTP id 98FF7100012 for <linux-mm@kvack.org>; Fri, 19 May 2023 07:41:59 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=TZkaK4N+; spf=pass (imf05.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684482119; a=rsa-sha256; cv=none; b=zv1owCOhRC53o8X8qxPhyiqHrtVyeSlkoHY4t7H7r4yVyWGT9G+wCSYKPT1rvsokQdBGzd F1OeqK4/ULEf1GjcW+LwSt3/p0qNfLcAd4LnIcimR1AVSCk6AG68PCyC+NGfmmE9fntg4N NUE9Ri9M4blpsuOru0ylo/RcyX8FgfE= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=TZkaK4N+; spf=pass (imf05.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=1684482119; 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=VhlnyEb6mYomF+UXhy/zVZBJsDbPWQmGyqF6ugPT8o4=; b=lGDlW5/cKHhnn/QXPVbVAOBTmfcdOTWqUuughj4rLS0yb0MvH09nyqBjHUh+eBNj9eZGqT l9UwnkZZXn6HkvQO5Te+O/gC6I8kCYMan0ZC0Mu87aSdi85sPHGze8Em+f7IWQdvopPYqP l1cz3n449HELS7R3+h4rFmFZpSIqvZU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684482118; 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=VhlnyEb6mYomF+UXhy/zVZBJsDbPWQmGyqF6ugPT8o4=; b=TZkaK4N+TbufBFr72NolMZvwSvdXOic0/ofYyT5HQJbvYaccCrAobnGd4geBJLXGGlxYpA MQVsPMlFP70qBeGpRTiWcTgj0Qb5MU6bC8HYlMAsI+WDys+ZOeVadLnuxnfYUCzi96Q3x0 1HlL0H/cP0eokpf8WHpgANmQByi0eXg= 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-290-tq44QnmUO9KmQ-WGEl3PcA-1; Fri, 19 May 2023 03:41:53 -0400 X-MC-Unique: tq44QnmUO9KmQ-WGEl3PcA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7B949800B2A; Fri, 19 May 2023 07:41:52 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id B8AEB4F2DE0; Fri, 19 May 2023 07:41:49 +0000 (UTC) From: David Howells <dhowells@redhat.com> To: Jens Axboe <axboe@kernel.dk>, Al Viro <viro@zeniv.linux.org.uk>, Christoph Hellwig <hch@infradead.org> Cc: David Howells <dhowells@redhat.com>, Matthew Wilcox <willy@infradead.org>, Jan Kara <jack@suse.cz>, Jeff Layton <jlayton@kernel.org>, David Hildenbrand <david@redhat.com>, Jason Gunthorpe <jgg@nvidia.com>, Logan Gunthorpe <logang@deltatee.com>, Hillf Danton <hdanton@sina.com>, Christian Brauner <brauner@kernel.org>, Linus Torvalds <torvalds@linux-foundation.org>, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Christoph Hellwig <hch@lst.de>, "Theodore Ts'o" <tytso@mit.edu>, Andreas Dilger <adilger.kernel@dilger.ca>, linux-ext4@vger.kernel.org Subject: [PATCH v20 15/32] ext4: Provide a splice-read stub Date: Fri, 19 May 2023 08:40:30 +0100 Message-Id: <20230519074047.1739879-16-dhowells@redhat.com> In-Reply-To: <20230519074047.1739879-1-dhowells@redhat.com> References: <20230519074047.1739879-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 98FF7100012 X-Stat-Signature: am7bjmfmydew1auxmd6zdxk8a159tn5d X-Rspam-User: X-HE-Tag: 1684482119-998041 X-HE-Meta: U2FsdGVkX1+O5ZQ10He58oatQMWAbSy4NUQQzTyropgXoxWM/zie0mzaERwzn5+BrqG8ok2wLBSVwAY73MslPEuiQjy0hI+EeIX8n0VfV3l7R4o7q8cPoHvq4bIFAcpjrIBQdKfH4Yr2t5D7YPorOKvF7AWb3++NKmgpe21UeHXKyz4YN9pXwTW/AzK7yCVRnprnhLhyRzXXVI4LsxiK3+Cjgx7Nnf+1WCN/BK1DEzSIuXnqMlHDg+iU0gwhjsGiOFGwHOGTRML/TTUGvtW8taZe4B24fiDEIMwzFGd2L499TYVuXP7RznYcl+NbRo6iw3h+8mKihi9pylYLOCnodXBmq8gJLGPuiXg3PKHnn7IznOYFmWHWdtntHhtcWnmOY0DiqUFix8sNDaNAwNim5rRfYVPN7MAomhpRphXxdTkaLLqkvbse3wTEsNs9x61FG9HBCZSsCiH8ILruNMEg9bU4nB2PHgRCp9V3WyI5xHdJ58OG/tCGw52AkCrY8EJF6dRSoIo613hKBq0w1odmbgGndRDYd4VEKEAzQZpyixZhzqOUnRtgvEQ/kZcnvpFe0xexS/m7VNtT7EMQW3qmWk4OOYkIHWyJzX4HiDdQEsGnuXoe+VD6JailEBIRMaLhCn4WASPLk3Irg/vWXEqvpdH4GFgcCb743etpo9U8gj63my0hFCaAMV0PsSZchaXSqR/s7TWaXzdMWPTKEfq5lDPpgeQ8aQlPSna9zyyhFbSSMJXFbMm2WA4Zf/OEYZHaWp9EwWmEW/reB+gXdiYcUl+t8oj6J3UAOh/y7X9zohJCcsZNxoRSimle0KqRCm2NwWv6t4H+c5S0jg8TCmpXwEY9xAUgyIxr9KDCjcUzqD34xWHTt5KeJ+Xyz0m3pdh8ZSyiVyrd5BVKtBT1qhBvfsmqwwArgBrIRNjk+GYx/HDz0Su3D9MrASjdPZJG7L+kmgq17uXCQu+Y1dIAiMu NmoJsBmq J3zWFD8eK8ZeydmmK9nPBOxtawp/LJxLhzYWZ+99En2WRCczKV+2bPxQkKDRdtHsRc/XnPhf/TUFG49bil1VcpW4QZ2PkADh0CB/3DXLfco8Zwu3pqsXAN1SzUaYVBXHK5FiObFh6EubEVkPN9YH6oDoWH3gX5vwAml5ltsu0vPnZtHHmnXWc0XEEeIwmEfsibJezmY8qdpRsbbongFUm4OCKNTsZi6I+Dk1yy6gt2gLYGC5ErU7kC6CmyFJ8+25tU+dyFZuenPMwK/ftgIDTcayKqE2K3EVo5HfePb9iQxtGvElhf0xdxy8KVwHS3ryMLqQp0x1XRWYR4zq1i3He+603y7ObbqGWo3P8BZ4APjSClL8yEbCBCMQtveH65tbChtgwdFGIlGUsPREMc9xJINLxkmFPgTxWSick 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: <linux-mm.kvack.org> |
Series |
splice, block: Use page pinning and kill ITER_PIPE
|
expand
|
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index d101b3b0c7da..9f8bbd9d131c 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -147,6 +147,17 @@ static ssize_t ext4_file_read_iter(struct kiocb *iocb, struct iov_iter *to) return generic_file_read_iter(iocb, to); } +static ssize_t ext4_file_splice_read(struct file *in, loff_t *ppos, + struct pipe_inode_info *pipe, + size_t len, unsigned int flags) +{ + struct inode *inode = file_inode(in); + + if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) + return -EIO; + return generic_file_splice_read(in, ppos, pipe, len, flags); +} + /* * Called when an inode is released. Note that this is different * from ext4_file_open: open gets called at every open, but release @@ -957,7 +968,7 @@ const struct file_operations ext4_file_operations = { .release = ext4_release_file, .fsync = ext4_sync_file, .get_unmapped_area = thp_get_unmapped_area, - .splice_read = generic_file_splice_read, + .splice_read = ext4_file_splice_read, .splice_write = iter_file_splice_write, .fallocate = ext4_fallocate, };
Provide a splice_read stub for Ext4. This does the inode shutdown check before proceeding. Splicing from DAX files is handled by generic_file_splice_read(). Signed-off-by: David Howells <dhowells@redhat.com> cc: Christoph Hellwig <hch@lst.de> cc: Al Viro <viro@zeniv.linux.org.uk> cc: Jens Axboe <axboe@kernel.dk> cc: "Theodore Ts'o" <tytso@mit.edu> cc: Andreas Dilger <adilger.kernel@dilger.ca> cc: linux-ext4@vger.kernel.org cc: linux-fsdevel@vger.kernel.org cc: linux-block@vger.kernel.org cc: linux-mm@kvack.org --- fs/ext4/file.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)