Message ID | 20230522135018.2742245-19-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 53B54C7EE2D for <linux-mm@archiver.kernel.org>; Mon, 22 May 2023 13:51:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E4237280004; Mon, 22 May 2023 09:51:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DF2AF280001; Mon, 22 May 2023 09:51:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CBB0B280004; Mon, 22 May 2023 09:51:44 -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 B26B0280001 for <linux-mm@kvack.org>; Mon, 22 May 2023 09:51:44 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 84CA71C6D45 for <linux-mm@kvack.org>; Mon, 22 May 2023 13:51:44 +0000 (UTC) X-FDA: 80818028928.01.C9369DE Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf09.hostedemail.com (Postfix) with ESMTP id C7437140010 for <linux-mm@kvack.org>; Mon, 22 May 2023 13:51:42 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=hjdXxxI1; spf=pass (imf09.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=1684763502; 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=k/c+R+8s2k3pMmNtZ3aOuXJCBbwfObn3G1z9h41bJkI=; b=sAKWjIWeuDEsqFd4ckjjSzL1f1F2HHbeFZ5VCXuFO4Jk+qTM0NkKuVJhRJh5fUEo6OO9sj y6EebWVyEurHZVesxjczvixXu7xWI/n0Lq8N5XfQBnfjQXGsP/vslJ7Ob7Goq0b12247Nb 943+mScv3biyMvr1EG10YeCBA1NWrFA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684763502; a=rsa-sha256; cv=none; b=cr6S87fYDn1mzHilQ+PEUDX/ICq2kD27gWq/RLt9NL1qR65eOgej3s9AchbGxFa4wfUslJ vKTZrkL1GKaBKDAXxFcWzT9Ij01vI2q9zM8E/AjK7HNz2eL0SQxuixdI3jf2VN/zMGwXNm gftIEtX3pN0Uup1G8Q0TbiCjbVrdjuE= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=hjdXxxI1; spf=pass (imf09.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=1684763501; 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=k/c+R+8s2k3pMmNtZ3aOuXJCBbwfObn3G1z9h41bJkI=; b=hjdXxxI1PAwmdF+Zl4F8OFTGN1CJlu59/tR9VY7drNh0S4c5m/MhEyH7JbVnKBsrFlaOv8 kf0v2n3T9JIDzle0ThI4qPmtBEOjNFkLhLjcNI3IgcxHGXZGD6tvnt/G2GHmQZ1wcz9X7E f0m2Oc33vPCFIDiBmJxB3WAcUx+DiZg= 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-423-NgNsZyJqPjue_3wdjfNq9A-1; Mon, 22 May 2023 09:51:37 -0400 X-MC-Unique: NgNsZyJqPjue_3wdjfNq9A-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 86DD7281294A; Mon, 22 May 2023 13:51:36 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.39.192.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id B290540CFD47; Mon, 22 May 2023 13:51:33 +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 v22 18/31] ext4: Provide a splice-read wrapper Date: Mon, 22 May 2023 14:50:05 +0100 Message-Id: <20230522135018.2742245-19-dhowells@redhat.com> In-Reply-To: <20230522135018.2742245-1-dhowells@redhat.com> References: <20230522135018.2742245-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Rspamd-Queue-Id: C7437140010 X-Rspam-User: X-Stat-Signature: zu8gn45szjat14sz5bodbcg8i53arg9f X-Rspamd-Server: rspam03 X-HE-Tag: 1684763502-724142 X-HE-Meta: U2FsdGVkX18DLui4veqKbyHHF4qtUoaPzBIBK4whYeBvgaFdoSNZi3hefB3/6l5gcLL69xsFXIROdGBYjhIy14NqlDr8LYzJHXoVkEKhjpvWFQP6JmbBlwahyvKRLE8jQaBCrsbOhSoKHkfhOS0SGCpB/S0e4rEj0RQUQ0OKxZhwXY9Nr5OLiHS2A7T5Th2qVC9+CTuJAHHsnPoGDyY7BRJMq8F7iqgne5TwuFSGrNokr+WcPEsySGdsO/BCoMlCanq4FvLePH0qUZqCS5oLbkWzdt+IuE04geKzHzUghiRSa+Akb3SCxy+aABfL3/G2Jc337wSm6AUaMz0g+uIiuRrYfZ+KHTQTr5y4dArAWe7ltrlraWmxYF68Z2OtCjGYbobNizPDRw3OQ+NCzoabg8QBaTjXDsuRMCmHE27vM3zIntPnRgityOE9pKQ1WoempGFa27dYdiuqO98v3fCOZMTrMNRWYKn03MbR/OwKuvaNbW3emq1OVjy2UPUE7RO65pEXV6ZD/hAhUvGbBwPGomA7g46rygZyKwTKUE573Uwse4eP8Vlq7f8S+RRkfOwCC0cugpuksId0Jg6wu7YQpQ5tM0VZT9sh8fF0pO1G1e+Az53+xcqg3VncK6hprqRC1M4oQHc+XkGLzyx/4G3JcpHrdetocL4es88IIzIdkV+n6dG66q8IWoFR/yBWh0f1RVV4NKcSxd+fMPpAOcyrPvCYNU8H71GIPO4hHPMrpOuaumjJ7zz3TDWPJoe9+NxU/lMzTAl0PtTvBOW+tXnLaRSAn6ZV0BffL/uk3LfVLuOLn6Ro1rr9r4Kp5Xn8W164BSlW20jtOofzRY/Y1IDSEcgwVzDDhO6onXE6Ny1flBxw8DG3S7EoJWfjQsJjrEJmyxFwyQzt43ENnLUAdYqhI/HBqSsDGLCuDvQ6F6z6NTvuVHtNffDVbM4xRltRkvPwtAHT0sLEGhDGe6i3uLw 3z0p/C8W ulAO1ZCpmw+Cw6MhM0wQgHDc4DutQ99nbd0urp3eoBZBfjMHPERBKT/ZDR6WsT8cljucdxmJOM423UbnR4rska9CH88VySfzw7Qz0TBUNn34InQHsyGqkyOrNdsRM6NSDFND9/sh49Tv8LL3aOCD5dFCGCmfa/ORsz0NjeJm2PjUWFE56T8PyLFr6AF2KOTf1eCbWnbYBKMshTwiq8CEuKTUhPUFBNX7c/y0ZK8sYIiFlzGnmQyC6Uwi6g7oy7KFVeBMQL0EkPZpMtOaKmuRZFJ1NPi/0kk1unNQ9eURc/mHAFUrSNIgZvk0/Y63bqA1mNaqug3oe7vELU0kFlP9oKdmUO54gdS7KAAsq813fXw1QF7YXMuwdOCjOlr2Ar71CAgoiWYi/E/Xtf+y8QK5H8z73v9E0m5PyD3WA 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: 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, };