From patchwork Wed Mar 15 16:35:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13176338 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 F0BA5C7618B for ; Wed, 15 Mar 2023 16:36:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 85A696B0081; Wed, 15 Mar 2023 12:36:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 80A6F6B0082; Wed, 15 Mar 2023 12:36:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 683E26B0083; Wed, 15 Mar 2023 12:36:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 593126B0081 for ; Wed, 15 Mar 2023 12:36:21 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 323FBA1135 for ; Wed, 15 Mar 2023 16:36:21 +0000 (UTC) X-FDA: 80571685362.08.6AE7EB6 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf05.hostedemail.com (Postfix) with ESMTP id 4DFA610001E for ; Wed, 15 Mar 2023 16:36:18 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=QQjxKO+n; spf=pass (imf05.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=1678898178; 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=Mo6NWBR6hkfydtMnZeO+F5U5GhN+vbQRFCzRyccP/1I=; b=vhCFhncrWXl0tt17Zin3x2gqvZ60jVWqnhbUL3M/6D9vPeGr80lJGFKFOXfuQbRbQpsYYy ql6t++p5GXCFX8pOS8vrAYhAQ3vOrBn6q8ZfPaw3DVY/1DiiyIEcPuhfp25uLuBw+DvJj+ +FE89/PZUr6NyGfNQV/7ea2DqAUGsoI= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=QQjxKO+n; spf=pass (imf05.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678898178; a=rsa-sha256; cv=none; b=faQACnGOvDz2U1tNI0XnC/sdzR11gEdzmB+V7kQqKUsyueZ/kHbhVUcjJyHKygJNY8b7Hb sRjbR6w0/qDcg2XfO7MP70EvvN4eGX61oVYnIVIIBKYG4aa6KtVl7hddvZihBMoSZZjI9U rO7CMZh73v52DP5h8Ahfx5ABoQ55Usk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678898177; 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=Mo6NWBR6hkfydtMnZeO+F5U5GhN+vbQRFCzRyccP/1I=; b=QQjxKO+nVYx7iAFg828rNSOk9aK470TkdzyNKixc/G4DJc8KEpc3VY7Et6yb7SFOHyCLVF 0pmwOnWC501xao0GmTMs2nRkKc6opViH+9kLD3p45oW1VEjN+aLyV1flHsjnJwE42T+J4C EYDERPcX3P0fq+LT8FuyBYQCYx1Yj2Q= 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-217-WMsh2JaSO0acjNRTd_X4qA-1; Wed, 15 Mar 2023 12:36:11 -0400 X-MC-Unique: WMsh2JaSO0acjNRTd_X4qA-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 9123C2807D8F; Wed, 15 Mar 2023 16:36:08 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id CEEBB4042AC2; Wed, 15 Mar 2023 16:36:05 +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, Jan Harkes , Christoph Hellwig , John Hubbard , coda@cs.cmu.edu, codalist@coda.cs.cmu.edu, linux-unionfs@vger.kernel.org Subject: [PATCH v19 05/15] coda: Implement splice-read Date: Wed, 15 Mar 2023 16:35:39 +0000 Message-Id: <20230315163549.295454-6-dhowells@redhat.com> In-Reply-To: <20230315163549.295454-1-dhowells@redhat.com> References: <20230315163549.295454-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 4DFA610001E X-Stat-Signature: rbstn4rd1c5esc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pMtMyCCyNq2NRY+2RCBmpwDYUx////TRdfnzM2Qx7c1EUxX6iLXD2oTSBFeb+CB6alAQRYaSiINdxvnqDDxOebih9h4FjmUu5o/wuJMGCyAz74A7Jdhy/IpfkLNwnn4UL8Bw5XlAiE9ag1KuZRNdYC1CB3dhM5erDC7FLN6vWVl0Xwnb9IvjYIpKJrZmj1DxQfJAv9BsdG6eMMppetlX83mCvfiPBvNGiXuLN52MlVs9lV7VpRjH7bBtUTaPRPRSF283vpxHcFQ0apWh3I7UnBYn0TyzMx5YuMciOiSzI5eJVIqLr0IxiLU/xzxZY+6WrJlE1ls7w9P+cyncFjqKZ0UYeMBtq3hXMdEkoNH8ttZJ5a4cDNmbbXzwT+H05ARSlns2KAowOBAtP6QeE44sc 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: Implement splice-read for coda by passing the request down a layer rather than going through generic_file_splice_read() which is going to be changed to assume that ->read_folio() is present on buffered files. Signed-off-by: David Howells Acked-by: Jan Harkes cc: Christoph Hellwig cc: Jens Axboe cc: Al Viro cc: John Hubbard cc: David Hildenbrand cc: Matthew Wilcox cc: coda@cs.cmu.edu cc: codalist@coda.cs.cmu.edu cc: linux-unionfs@vger.kernel.org cc: linux-block@vger.kernel.org cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org --- Notes: ver #17) - Use vfs_splice_read() helper rather than open-coding checks. fs/coda/file.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/fs/coda/file.c b/fs/coda/file.c index 3f3c81e6b1ab..12b26bd13564 100644 --- a/fs/coda/file.c +++ b/fs/coda/file.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "coda_psdev.h" @@ -94,6 +95,32 @@ coda_file_write_iter(struct kiocb *iocb, struct iov_iter *to) return ret; } +static ssize_t +coda_file_splice_read(struct file *coda_file, loff_t *ppos, + struct pipe_inode_info *pipe, + size_t len, unsigned int flags) +{ + struct inode *coda_inode = file_inode(coda_file); + struct coda_file_info *cfi = coda_ftoc(coda_file); + struct file *in = cfi->cfi_container; + loff_t ki_pos = *ppos; + ssize_t ret; + + ret = venus_access_intent(coda_inode->i_sb, coda_i2f(coda_inode), + &cfi->cfi_access_intent, + len, ki_pos, CODA_ACCESS_TYPE_READ); + if (ret) + goto finish_read; + + ret = vfs_splice_read(in, ppos, pipe, len, flags); + +finish_read: + venus_access_intent(coda_inode->i_sb, coda_i2f(coda_inode), + &cfi->cfi_access_intent, + len, ki_pos, CODA_ACCESS_TYPE_READ_FINISH); + return ret; +} + static void coda_vm_open(struct vm_area_struct *vma) { @@ -302,5 +329,5 @@ const struct file_operations coda_file_operations = { .open = coda_open, .release = coda_release, .fsync = coda_fsync, - .splice_read = generic_file_splice_read, + .splice_read = coda_file_splice_read, };