From patchwork Tue Feb 14 17:13:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13140633 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 247A2C05027 for ; Tue, 14 Feb 2023 17:14:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B59256B0078; Tue, 14 Feb 2023 12:14:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id ABB266B0085; Tue, 14 Feb 2023 12:14:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8975C6B0087; Tue, 14 Feb 2023 12:14:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 70A446B0078 for ; Tue, 14 Feb 2023 12:14:19 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 218CEC0E7E for ; Tue, 14 Feb 2023 17:14:19 +0000 (UTC) X-FDA: 80466545838.28.0AA1D26 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf22.hostedemail.com (Postfix) with ESMTP id BD082C0026 for ; Tue, 14 Feb 2023 17:14:15 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=TAQLjtQJ; spf=pass (imf22.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=1676394855; 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=9CqUl4uoQ+LRGKUoO3X6p5TYca6H7tIaOYxOpOq6akk=; b=UWP85/7VHhIj2zyEO4a5IM0wiKNifNU3JXxmVu/DF2OuWAhVUpWDn/IO38tp20+Om9kwNL u/g1n+wOG+6LDDgfcUqrPxeL/gnJ2ySW7Jyx24I6RYLTKlRszvvK1UiaG0C8wpFj1QxZx4 N2bZpWMYqdA11B1yGiXoDyuQyU6MJ9E= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=TAQLjtQJ; spf=pass (imf22.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=1676394855; a=rsa-sha256; cv=none; b=R/yw4aovNyNlFTegoNiK2LtN9nMVPtU1vS9pVtiJVmXWPb9mp5CN3wMz5ovkG21UGjmyVU eXuOU1+VFCmh/vBDNH+WspGWbiUQo1cqCw5s2FcQuYd9hpe+YVHYUAZ6sPR/oBDI51/jfB 4uwUIS5z/PgHXAXDT7a+vwxl8J9YvzE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676394855; 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=9CqUl4uoQ+LRGKUoO3X6p5TYca6H7tIaOYxOpOq6akk=; b=TAQLjtQJBeo6nHoCYBN0mY0gxeo5tFFkXqoA1wVsvGB8i0ee1HoEbXri3+XWOOhfjZmwsU 5yJjq7kRHP9i/Ajyk5QBQrklliN3FJsafRsha+dqffw4jaeo/uY0SHV5pOMerYqUX1C27U HQvPV4oz3HnYutAJ/6gH5vL4DsojUQE= 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-253-cDT_luHMOIyAlH60JlEtxw-1; Tue, 14 Feb 2023 12:14:04 -0500 X-MC-Unique: cDT_luHMOIyAlH60JlEtxw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A98F52817248; Tue, 14 Feb 2023 17:14:02 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D058492B15; Tue, 14 Feb 2023 17:13:59 +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 , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Christoph Hellwig , John Hubbard , Jan Harkes , coda@cs.cmu.edu, codalist@coda.cs.cmu.edu, linux-unionfs@vger.kernel.org Subject: [PATCH v14 06/17] coda: Implement splice-read Date: Tue, 14 Feb 2023 17:13:19 +0000 Message-Id: <20230214171330.2722188-7-dhowells@redhat.com> In-Reply-To: <20230214171330.2722188-1-dhowells@redhat.com> References: <20230214171330.2722188-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: p1heggpduftxq8jo4gq5mh47431x6fjf X-Rspamd-Queue-Id: BD082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IvdNNZtglCJd4zY+GOqZ65wXk3gWnBor9ohmuMnVtVD3CdpeCp0V6eH+mt1SnnUZB4v5yIkMfrguXpbkA1grpu6Cnh5rhelUn260WTqzqQ/PuFuYXL5jDkt/qq887huzKmYoRHU9rMF1zZLhotQ/OW8jFvu7DSCOyXiJG5WKpvWUgUA1tRLCu4t9liAf4TZMzAvJ5ZgrkaRCOdunAQoDcD4Rxnj+j6oRhT5hOWqniHqv9KFmKfrpJ6nAbeqjH9avwp5dd6SkPkYTucMEi8UTBPrsUPRPGs+9AncRxISmKJ3Jm+GzYr6vNWhP4GI8Kx+3hIZXzfU6Ehtmr/PsFRJLXchy3QqXQrMjsZgyxy3/MgSkhmJSLUW3 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 cc: Christoph Hellwig cc: Jens Axboe cc: Al Viro cc: John Hubbard cc: David Hildenbrand cc: Matthew Wilcox cc: Jan Harkes 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 Acked-by: Jan Harkes --- 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, };