Message ID | 20230519074047.1739879-21-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 01B47C7EE33 for <linux-mm@archiver.kernel.org>; Fri, 19 May 2023 07:42:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 89E9390001B; Fri, 19 May 2023 03:42:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 84E30900003; Fri, 19 May 2023 03:42:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6F03B90001B; Fri, 19 May 2023 03:42:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 5C801900003 for <linux-mm@kvack.org>; Fri, 19 May 2023 03:42:16 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 366961C7929 for <linux-mm@kvack.org>; Fri, 19 May 2023 07:42:16 +0000 (UTC) X-FDA: 80806211472.23.B43FE02 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf17.hostedemail.com (Postfix) with ESMTP id 7ACDA40012 for <linux-mm@kvack.org>; Fri, 19 May 2023 07:42:14 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=RiFdtn8r; spf=pass (imf17.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1684482134; 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=uuCSAVZVpWhK4klEEqx7Ct2l0SGs5ZJdbhyX0+gkImI=; b=WScUWxKfN3OtVTFCOEykeXIGK/6tV/52EnOpK8r2o1LVcj86rPvZdbypQzxtjWM4Ox+sS5 Ul3YBbXHPG/dk5t83FLMCpHiAXPnDNNxnOXI9OrZqLj2lUIbJnBbmty7Z+dxFIomcs/05A 33SmvZdKKjAqyD6LNjwo/xavBCF9OQ4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684482134; a=rsa-sha256; cv=none; b=DPhmgfgLg5Fr35fcgVKQoXeT06Bl308GV65k8Ssk1/M5Uiesd5eOEbzY0dw3UDo2ASlpv6 dro7tj79nz7fyFTylP8ByYbvbZF8TfaEAtkruhHG4BFPaJ9vWn9xb1uMHXcVFuxP32qdyX //ToRzb86PfsB/GkwL/2Fe55ODhG5eA= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=RiFdtn8r; spf=pass (imf17.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1684482133; 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=uuCSAVZVpWhK4klEEqx7Ct2l0SGs5ZJdbhyX0+gkImI=; b=RiFdtn8rdi0r6MqnwRMpeS9k8j4SYLjZ278vKPRVJcIkLDB2cQlDnp1kHX9gpE1gItNp3k 9kgaRnq9vAV6IVlcJ5nNRKEk3SBbRyci7a6W5GoXop0zaeIiHXU8/2jUuaye/ofJz6NATs 6xfcwwpAznSFgRT+u+0HdLLFF8qTvog= 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-570-9WYmFVhKPfigCOXLKK6NJQ-1; Fri, 19 May 2023 03:42:10 -0400 X-MC-Unique: 9WYmFVhKPfigCOXLKK6NJQ-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 43746101A53B; Fri, 19 May 2023 07:42:09 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id A998E40D1B60; Fri, 19 May 2023 07:42:06 +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>, Mike Marshall <hubcap@omnibond.com>, Martin Brandenburg <martin@omnibond.com>, devel@lists.orangefs.org Subject: [PATCH v20 20/32] orangefs: Provide a splice-read stub Date: Fri, 19 May 2023 08:40:35 +0100 Message-Id: <20230519074047.1739879-21-dhowells@redhat.com> In-Reply-To: <20230519074047.1739879-1-dhowells@redhat.com> References: <20230519074047.1739879-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Stat-Signature: de1txn8q6pzetcrntpinjmmgcmkfwsg4 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 7ACDA40012 X-Rspam-User: X-HE-Tag: 1684482134-540029 X-HE-Meta: U2FsdGVkX199AHX9kAGUb+S1D/FBxtMy4kITSv7LTyoJc4DMq1q3tMfrloQdFD0FE2Fxvaqz8Dv3Q5CkSXJNNsQmEzek4AAuJCccOIBCcMNXi/lnWsKIpJZq9qvRRDueG/CQxY6BhfLGtyw3xB+CiUiavdqW3hA8/7jqs9AmF0+t3IiuYyFC7CDv2msBiMNDKB2DNVOxefJKFIdiAqxltzeEbFuhSgEyzMU5hQ5iwAqhXAhWZZJb5Pef2RmoqYt2rYkao0sTwVspnncH4KKC+pNOSwCVtBKdv3VmY7jSIk63WOLRogzHpy/Z5OG0unlLINsnsP8YhC/QRG077vzhJUFnCsA0syrOm0waSK63IbNOxGRXG7sreKR8aaSXerrL7R/iV416IfOgEHHlRBp5cMNHqzgg36pU4CI2vqrFquCDegIIfJy5M/85QRiWQNS4xa2UbYaPRXbrIX9EqRiMJdZhcdDk6KadwWChRHlg9g2HmGxGkiURGIzU2EvRNffTiHWbYbVC1ox+IIw6MMbY+EvLRpPfEOaLl2C6SDWtCY7MXEP3C3nj30g3KX8SH0xYTKdHhoa2CaVVZjjS0ltyzjamW9LvkoeBJxTWttV6sd3hPhRid+e+qd7EBMx4ou7K6HtKSCOh8F4ao22KKBzbsZ2GRHqidtcUlZcH3RoeN3Mw+2xYkkF3gOJHhkouC0rzNK4YHqQaNrfyeBrYoNSTySmfTtaHOHo5zNqggStNzNENYlgqVIfC/5JEoSREGdfSlEp7CtTusYCVif2Vy+PXkUQ6K1c97vvgTnIKwqLhL49yv2bXs+ED3GpkEX+kI7p4XiREuzQBWRGnuyKsXhSYlJdOKUixThVKiSiJm1jUGxmnwJLcJOL5LQ4ajXeK/tKN2pXKyuKKypz09uMpdyFupaFD6ynnCJCqHgIN2ADIlZCfBupVJu3KjPRASVfm6hiQec1dxSRqm1uKfR/ob2y I8p6RCnI vV76ZUGdjNVlJh+skG6Dv7zQ6ryaXQj0LmUG9YPJF4FPlvgwb37jrz5wRAbLvgFr0M+0DUiLp7vCpYhku7ZuT2ZrQ1ui+ltvMbjmLwBof/MDWCJwTFqproA3WT4vVnRXaHdmmsfJlE5JIgogODRs5bG/rYH3NqzsTkoJCRV78VuICvJXLm53IPHai56trwN/XZQKjNtGAdbHv1FqaQ6PKwha28/kyBbdEf6aoWGgsxv/pNmfp8vUfKggTUfYs6HQOk1xxEJs2l9WlO8+weXXp3qEekVVHJ/IAO7sK2h7pDcE9Pghcoy1p9gk4REfr7knJ95kNy/cIHt3rYjPH6FCFhW4esmwlJvIzDcnGE4H9rhNktTUPNhutygkmYcpa9ZVa/WT2IxKFMO2+Xuo0YVNXbwjNCqHLMEn0mbXiIrDRyidiDVSdx2c6ba7Ect3TJuYI6lSzqj2aftE/RI4VkVIo+wEWfw== 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, block: Use page pinning and kill ITER_PIPE
|
expand
|
diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c index 1a4301a38aa7..c1eae145e4a8 100644 --- a/fs/orangefs/file.c +++ b/fs/orangefs/file.c @@ -337,6 +337,29 @@ 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++; + + if (in->f_flags & O_DIRECT) + return direct_splice_read(in, ppos, pipe, len, flags); + + 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 +579,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,
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. The lock must not be held across the call to direct_splice_read() as this calls ->read_iter(); this might also mean that the stat increment doesn't need to be done in DIO mode. Signed-off-by: David Howells <dhowells@redhat.com> cc: Christoph Hellwig <hch@lst.de> cc: Al Viro <viro@zeniv.linux.org.uk> cc: Jens Axboe <axboe@kernel.dk> cc: Mike Marshall <hubcap@omnibond.com> cc: Martin Brandenburg <martin@omnibond.com> 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 | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)