From patchwork Wed Mar 8 14:37:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13165952 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 1D2A4C678D5 for ; Wed, 8 Mar 2023 14:38:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B3C96B0078; Wed, 8 Mar 2023 09:38:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9634A6B007B; Wed, 8 Mar 2023 09:38:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 80592280001; Wed, 8 Mar 2023 09:38:17 -0500 (EST) 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 71C3B6B0078 for ; Wed, 8 Mar 2023 09:38:17 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 45F3E40203 for ; Wed, 8 Mar 2023 14:38:17 +0000 (UTC) X-FDA: 80545986234.27.E94DA69 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 7D03B140014 for ; Wed, 8 Mar 2023 14:38:15 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HV7rsBjn; 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=1678286295; 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=2VxSf4XlD6Tq7Rp6h04Xh27xM5QEWu2hXwF5fPrnqQ0=; b=VzyWH3eycU6399aLXkJzkleekuBlJpCuGvcnIZ1+YxA6B3JC8muIpD4vlp03ynvLgDRPxP ZLGxg3dkhqioUFUhLavzf57De0jUw2ulOVLx0bss7ujlZaeHk1WacXndQfBGcf0m7Wywtk iQTHAB6yMdcyAdNOyQIvcAXq6F1hUqk= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HV7rsBjn; 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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678286295; a=rsa-sha256; cv=none; b=jmQ3xCv7/E7tLOVuGV3MVUNR8KPLkIHLEieN9311/GxGrd0/hjoK2auBW+BvDDNN41LwkN BzXQ7DrdL9x590LJaSuJP27AgnYgZg8+v5zGLz3qOhnvRE0vuTHddzItbR4Z0+3Oe3e+8c rM2QG0ZXXbOw/KFtSswi5dY9W3nRPm0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678286294; 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=2VxSf4XlD6Tq7Rp6h04Xh27xM5QEWu2hXwF5fPrnqQ0=; b=HV7rsBjn15P2H3unth1ccCDTUSQlkFLHR+gZORhpNB2Ju/0NZZW5bHw0EVSfUQMc3JZ/k2 8Uinab6Xwdlu/dbUND47NJrYjsLuT/TyJn2ohhxVhjvs1kPCd54TNAUVdpeLvL2sBlVFf3 pkAy0q1R+pvExGxdgWQdNQzayiGpZJM= 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-647-K6sCAm2YNpimy6kvSNJiow-1; Wed, 08 Mar 2023 09:38:12 -0500 X-MC-Unique: K6sCAm2YNpimy6kvSNJiow-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2AB61101A55E; Wed, 8 Mar 2023 14:38:11 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F6222166B26; Wed, 8 Mar 2023 14:38:08 +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 , 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 v16 04/13] coda: Implement splice-read Date: Wed, 8 Mar 2023 14:37:45 +0000 Message-Id: <20230308143754.1976726-5-dhowells@redhat.com> In-Reply-To: <20230308143754.1976726-1-dhowells@redhat.com> References: <20230308143754.1976726-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 7D03B140014 X-Stat-Signature: spekw35y3m4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/7PmLQs88vb/G5fMaBrgMjS8PMqLniSQZbWSSUcwQ5pIROeNYHaMpHs67uK9B+MSb48BG0F4MZ+b3JGyKS01GLWL2lwEf1Dvq1bnP87WDTGqgmbrflA33zWiuB921DCx86pyZZNXrOADnvVwoN/MYvHGiIcuF2Ann3XlQL3ZXVElsETJqgYjdWLGjhi7N+4Tky366GyWpkZdSV88AA5Yx22wu5nbrZwUH025WVn6KMGbvoMiSwqUEpk7OK64ThcKQ0glPGlX1zROR3ft/738g5F+Y5Co3zIpJaOie80Ct/m4ECt1HEHn0m0MdTwiKLhxYpkEXZgCev6PrIAYibgrzqPM40Zrbk8P+TD4gpP++PhCJ9bQbxcpIsiqWKVMadLB8TStiAHM4bo6gzQa 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 --- fs/coda/file.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/fs/coda/file.c b/fs/coda/file.c index 3f3c81e6b1ab..33cd7880d30e 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,39 @@ 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; + + if (!in->f_op->splice_read) + return -EINVAL; + + ret = rw_verify_area(READ, in, ppos, len); + if (unlikely(ret < 0)) + return 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 = in->f_op->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 +336,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, };