From patchwork Sat May 20 00:00:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13249003 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 F2103C77B7F for ; Sat, 20 May 2023 00:02:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 86523280002; Fri, 19 May 2023 20:02:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7EE62280001; Fri, 19 May 2023 20:02:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 66863280002; Fri, 19 May 2023 20:02:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 51A78280001 for ; Fri, 19 May 2023 20:02:14 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 2DB6B80B84 for ; Sat, 20 May 2023 00:02:14 +0000 (UTC) X-FDA: 80808680988.28.47801EF Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf12.hostedemail.com (Postfix) with ESMTP id 763C640010 for ; Sat, 20 May 2023 00:02:12 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=fJtM7YFA; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf12.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684540932; 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=Kng/NpyyP/9HUThEsQ3KFbnP3O5VwICNL8GAUfOxY8E=; b=rlBZGmTsmWzwbHRVUBJuGl7kKHjyCcoRQc/eTlAerfzfF+lyQNcEgjpt8WOPqGv/B//oQF /o8O1H1BOhnjbRqgUdUN8sVgvw4WYDDCdZVgdEtSpYOkEGXd+Q9zMMjk7GmdAEAp0ui20S kW1T/DlvCqjoTI9/bb6s3m3RoWyaPxg= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=fJtM7YFA; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf12.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684540932; a=rsa-sha256; cv=none; b=3MBcQiCgNgPu9a+GCDDLsbw9qeNPSR3sBNp1/2S9eGRaoDGv7XJ0JNUxeI3J6yFQG1i7In OmFVDXvBIO3XLTp0b8OB+HTgQRtPDEDigQuJ9C+9lM1OX1mM9QPfJPw8oun8yXx5OqGEaw CxRHa4Ja4H1pEpyEytQQjPBwQyAYbgo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684540931; 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=fJtM7YFAwnjWNHMhCizFxtDv+dDjio40eAowusfEyEVd22e1woVkSeNNd0qJ4MIKAB/Ukt p+vDghX8bu6YyY45BTs2aTsGiC6iTBF4RARVyjbOhvZe0rDLn9s5BRlmkKB4R80Gg0MnLo 9pGO/tq/LtT0NiL5zqZ9bsm4R1TYMcQ= 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 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 763C640010 X-Stat-Signature: jwkp8xe3h9ddx9hhys8x6z4kdiqjd364 X-Rspam-User: X-HE-Tag: 1684540932-690901 X-HE-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sDfEUeCCzWDgr7bYMqNAnzr+9jB562bDAcO0Z8u/PQyENIpIer8YKVbpQRtTPxn1xsIBOtq8ORxsW0K9tXQ9yTRN4zGD1n8pQVTQv4lkokNg8LA9Wmtv/aNNt1YNd8y3qDJPPYx8HKdkQAsUwVhGQrsN2ziXRnSaz5I9cv2xJqzGvW0j+YiseYciilqqUJHFCnuM2Qx2XoXHsA4JJJa0x5Us5M/boL4H8ZnaBD1tRxIdZxg2ZN9l503as5dJf58z/IyDyDF9kDuiPj/HVmDfmi2BetkNPcQ07/bInXYq3NGo1soqroroy434BeeL60ajSnlgB3W+PASl5wsGTM/tuFS3RhKRxeYXTJuqY8M8qMbVAFpN5jQ0paoPpxsE+2lr0W+bv41I2w== 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: 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,