From patchwork Sat May 20 00:00:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13248989 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 B9CAEC77B7A for ; Sat, 20 May 2023 00:01:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D489D280007; Fri, 19 May 2023 20:01:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CD4E6280001; Fri, 19 May 2023 20:01:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AFE4F280007; Fri, 19 May 2023 20:01:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 95869280001 for ; Fri, 19 May 2023 20:01:28 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 6CDB1A02FB for ; Sat, 20 May 2023 00:01:28 +0000 (UTC) X-FDA: 80808679056.17.2D6F3FC Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf19.hostedemail.com (Postfix) with ESMTP id B83F51A0018 for ; Sat, 20 May 2023 00:01:25 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=hkLNtPNW; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf19.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=1684540885; 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=zbFi31jMxWzghDu9RJeKpwLNk82XZBGuvfsvQFuMAZA=; b=PxIhhsRoGXrZjsmWzQF3RhFqYEWapY/ct5ZnVCzwikPNoNLii/9qwGeKzLuqc3VO25/Fic tK4FRBiZqdqMNAyqI/mbKKmGEC7hd1VkwbEGPu+XOsss7pJ+H7OwbDGgJgD/jofpP4uovy r7XJh/ikYc4YZrTmmoJ1f6aiM/rBCuc= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=hkLNtPNW; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf19.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=1684540885; a=rsa-sha256; cv=none; b=7Z4CSVQuBXXia45aAh82Ow20cEOT+w9ZelQACSwDl7hugAjCXPsz4GxNab9Z3zdWyvHR7M EP8kyBN0ce2d3evhQD/klgchAnHAtTwHJ4G3+Nbw4svj7jFJ8+oH7cVIIZ1YZdW3egFH0b bs0Aw++DQnudNA9HLqrylm9fotEMBIM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684540885; 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=zbFi31jMxWzghDu9RJeKpwLNk82XZBGuvfsvQFuMAZA=; b=hkLNtPNWe3gRR6EhmnZdL9VaqFS773XFpkoREwd2h7uw0bLi2AivPwzZmApDfg1U3lPSl2 UmVh9LKAsbupMJZ/w866EKLmQbIZ9vP4MjPoLFmOAu2BRbAS0qLKLzp4+ieVzRnTmeDevK VBA6nWE0hQ75c8dzYRXEfQxBF30OpP4= 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-498-boGls4mfOPmRYAKfMNAYJA-1; Fri, 19 May 2023 20:01:18 -0400 X-MC-Unique: boGls4mfOPmRYAKfMNAYJA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6A57D3C01DB4; Sat, 20 May 2023 00:01:17 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0BE5F40CFD46; Sat, 20 May 2023 00:01:14 +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 , linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH v21 08/30] splice: Make splice from a DAX file use copy_splice_read() Date: Sat, 20 May 2023 01:00:27 +0100 Message-Id: <20230520000049.2226926-9-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.1 X-Rspamd-Queue-Id: B83F51A0018 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 6zj5ctimzcehyxqg5dgkewhwuczy3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OhGURHgvUFzI2CUCNFpPpBu+gCHP/1oF2b729hAeBXhOicduf9xREyCA51qinGtL1qawa/ffsK/nARtS+LYWnTcspKKb4ygL6RwZXdL1k0UjT3ifvrh1dCcgx2oiqDGtTa1nKFzb30IpE33X2mWJ5AZH4XMr0a3qoN7RtDwyhPRh2AJ9nEWWYWqAj7ELYXe5Q7Ox8ypjTJOt32s55M8ENXCWt0Gayf0Y97i4rIymQYJa6TacODl+3udwhKxa7O5uj5l26d/yDUhleGfFLZp08wMN8+IRlliH+UdEY6eF8WBFqMqaQMzxZqQX39Fg9h9gsPyE1YClthkhqM87VKbeQsY2XFqeNhY6wZ2uycZ+YlmnALSMpWxJICpi8= 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: Make a read splice from a DAX file go directly to copy_splice_read() to do the reading as filemap_splice_read() is unlikely to find any pagecache to splice. I think this affects only erofs, Ext2, Ext4, fuse and XFS. Signed-off-by: David Howells cc: Christoph Hellwig cc: Al Viro cc: Jens Axboe cc: linux-erofs@lists.ozlabs.org cc: linux-ext4@vger.kernel.org cc: linux-xfs@vger.kernel.org cc: linux-fsdevel@vger.kernel.org cc: linux-block@vger.kernel.org cc: linux-mm@kvack.org Reviewed-by: Christoph Hellwig Reviewed-by: Christian Brauner Reviewed-by: Theodore Ts'o Reviewed-by: Gao Xiang --- Notes: ver #21) - Don't need #ifdef CONFIG_FS_DAX as IS_DAX() is false if !CONFIG_FS_DAX. - Needs to be in vfs_splice_read(), not generic_file_splice_read(). fs/splice.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/splice.c b/fs/splice.c index 76126b1aafcb..8268248df3a9 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -908,10 +908,10 @@ long vfs_splice_read(struct file *in, loff_t *ppos, if (unlikely(!in->f_op->splice_read)) return warn_unsupported(in, "read"); /* - * O_DIRECT doesn't deal with the pagecache, so we allocate a buffer, - * copy into it and splice that into the pipe. + * O_DIRECT and DAX don't deal with the pagecache, so we allocate a + * buffer, copy into it and splice that into the pipe. */ - if ((in->f_flags & O_DIRECT)) + if ((in->f_flags & O_DIRECT) || IS_DAX(in->f_mapping->host)) return copy_splice_read(in, ppos, pipe, len, flags); return in->f_op->splice_read(in, ppos, pipe, len, flags); }