Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp146141rwd; Fri, 19 May 2023 17:05:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6XZdsbd9q//y+3etQiMNBvtKS5s3ZddB1KAG6DZB194wCcG5r4ptJqynWwgGqYaRJaKotd X-Received: by 2002:a05:6a00:1819:b0:646:e940:c2c4 with SMTP id y25-20020a056a00181900b00646e940c2c4mr5279341pfa.14.1684541137936; Fri, 19 May 2023 17:05:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684541137; cv=none; d=google.com; s=arc-20160816; b=KJcew9DdK1dPhhAVMnIbrv9OeLFqvrfN2QZbbf96Sv/XMpmEpi+43LsAe74BWMkcwm m7mLyCK3776voleroDSKuF+4ju4MCAQS+WTn78VuFLLIKmf6v0G8RunJhESyqdflstZR qNgk0Y+3hxX7LwNgnpxZju5xZ6oaR9E9ye+E8a4OtSnF7xPB8t4aooJU7Dgfs+XzFeA3 p/EnG3bGq/YFJtjbGwLV6+92C0sNs5eW1GUmPyEnbQ6LGXqJ4ZsvqgjFNYWLDU9zgKOY pTkL9apitmJViWZ5TAAmHqBrjW/FuWqAaMEhqmFzH9S+UTnAEDiua+u+g93sKx5iOWJC 9qfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Kng/NpyyP/9HUThEsQ3KFbnP3O5VwICNL8GAUfOxY8E=; b=JZig+mMiv8zY92Qeh3txOmsQGsRdqv6EgmO1T5dpMbCdyA17Zji08qv4MWsqxe2yEs 4XQqLkaolB2fYgcRFWbmzXNiFPNebOaJ6ZoU22K5xNBLWGeXDXLDS/1h5hmypQq0rMC7 wgDUaQd5xWp5i2+VWyRnbm6CIHFmN3DujxAj3pyelPtWDwTld5pnGBKjFP9V20PmkaN9 0JvR42+3z3GfHQXMbITLj7jQ7mS0TOfgTSA2g+m2mHmDqZhUdG7n77XoKG/uxFwgL3DA Aa+Q0mPnS/L2HBkvT8kC7kK8UySCu0IPLtYpJnGxwTLrOiTufSiTTkjS7HH23R45aUqj ho4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=f4ViWeA9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s30-20020a63925e000000b005303a66d415si435147pgn.405.2023.05.19.17.05.22; Fri, 19 May 2023 17:05:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=f4ViWeA9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232089AbjETAEr (ORCPT + 99 others); Fri, 19 May 2023 20:04:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231261AbjETADx (ORCPT ); Fri, 19 May 2023 20:03:53 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A59DA19BD for ; Fri, 19 May 2023 17:02:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684540930; 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=Kng/NpyyP/9HUThEsQ3KFbnP3O5VwICNL8GAUfOxY8E=; b=f4ViWeA9Dt3H/xX3Man8NCA784hUlWE0hf5sK6Ul/itD+2dZjKBIhsPQ8h7JccZJe4K2qv q6FoHdDDbYfxY1q7RoY6x5inGw2DURT5fK1cbQZk4xdfGbPmZ876Z2MDmDQGgTLh+b8kuS G8ADmU2lq3NogLhfa/C2HjMdqRCMh9U= 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-410-R98rrHZxPWqxxp4SboXMEg-1; Fri, 19 May 2023 20:02:06 -0400 X-MC-Unique: R98rrHZxPWqxxp4SboXMEg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7F212296A609; Sat, 20 May 2023 00:02:05 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2587640C6CD3; Sat, 20 May 2023 00:02:03 +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, Christoph Hellwig , Mike Marshall , Martin Brandenburg , devel@lists.orangefs.org Subject: [PATCH v21 23/30] orangefs: Provide a splice-read stub Date: Sat, 20 May 2023 01:00:42 +0100 Message-Id: <20230520000049.2226926-24-dhowells@redhat.com> In-Reply-To: <20230520000049.2226926-1-dhowells@redhat.com> References: <20230520000049.2226926-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Provide a splice_read stub for ocfs2. This increments the read stats and then locks the inode across the call to filemap_splice_read() and a revalidation of the mapping. Splicing from direct I/O is done by the caller. Signed-off-by: David Howells cc: Christoph Hellwig cc: Al Viro cc: Jens Axboe cc: Mike Marshall cc: Martin Brandenburg cc: devel@lists.orangefs.org cc: linux-fsdevel@vger.kernel.org cc: linux-block@vger.kernel.org cc: linux-mm@kvack.org --- fs/orangefs/file.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c index 1a4301a38aa7..d68372241b30 100644 --- a/fs/orangefs/file.c +++ b/fs/orangefs/file.c @@ -337,6 +337,26 @@ static ssize_t orangefs_file_read_iter(struct kiocb *iocb, return ret; } +static ssize_t orangefs_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); + ssize_t ret; + + orangefs_stats.reads++; + + down_read(&inode->i_rwsem); + ret = orangefs_revalidate_mapping(inode); + if (ret) + goto out; + + ret = filemap_splice_read(in, ppos, pipe, len, flags); +out: + up_read(&inode->i_rwsem); + return ret; +} + static ssize_t orangefs_file_write_iter(struct kiocb *iocb, struct iov_iter *iter) { @@ -556,7 +576,7 @@ const struct file_operations orangefs_file_operations = { .lock = orangefs_lock, .mmap = orangefs_file_mmap, .open = generic_file_open, - .splice_read = generic_file_splice_read, + .splice_read = orangefs_file_splice_read, .splice_write = iter_file_splice_write, .flush = orangefs_flush, .release = orangefs_file_release,