Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp144412rwd; Fri, 19 May 2023 17:03:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7yKT/bGhRppB77iqRnlbfTMlUoQnElwwaMZ30/LPYYd9fehvZg3ZttXf/MkRTWfRX9oPag X-Received: by 2002:a05:6a00:244a:b0:645:fc7b:63db with SMTP id d10-20020a056a00244a00b00645fc7b63dbmr4957374pfj.20.1684541034164; Fri, 19 May 2023 17:03:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684541034; cv=none; d=google.com; s=arc-20160816; b=NgEKeWvMDslvG/jOHGNA0ESaS2eunHKMQZmwbKDtEu2VZp3cPEpM4G88xBr/N2hgkv FtGHs0PMt6iU7xkv51uqqijisFqXMoNSLZgT5RKZQ9Qc1YC1StdB2asziKhwdfLcolSi OfnmQdrBtZqYxmFvozne5OiB+LkC9tC547Ycgil9lznnG6p9mvvuiBogoo0PF9xng2tV VXwpuFkS69eXta6zf8Njpj0vMLoKg7aGbBiWrxRLDVjNlYyb8Av8p3qG7d+KM2a1X7HR unMTIxFprPOHqIoH/7d55bkAQKikypFUIE0kO5WTXACYGAOUlGjF8GnGlI4HwAjcB5Fh QxqA== 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=zbFi31jMxWzghDu9RJeKpwLNk82XZBGuvfsvQFuMAZA=; b=eaWku5Ilf0Ns8zEefSMcy3kxD27lsIRDA5SBNs1scexzpO1c/tJlm8bFlxncFwImQQ UDhM+bJnW4zFw9lZcmlmz0Chw/IWn4micP1k9q/xI2/EAlrAGKQkU/LqNP+pfSmMjljc q+6qFAyvikY5CzsxGq1VKNt0RmhfQSVPbPSU6TyRD83pI2ukvUaQfPtfXUEq1pi7N4zb NgE1VMKp9gEabfO2YZLHS6NTvBH64CEgnAZMB3sJlQEE4v1tfrgdOKPZpf41iGEABuXG f3Ct9SGE5+EmsDA2MCU94mt2UuL6hntd0Rx7eOb0Ou9PKO7Q++lt9x9aM6waDHDERXp7 c17w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hkLNtPNW; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-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 e184-20020a6369c1000000b005250c235984si412092pgc.860.2023.05.19.17.03.37; Fri, 19 May 2023 17:03:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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=hkLNtPNW; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-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 S230236AbjETADR (ORCPT + 99 others); Fri, 19 May 2023 20:03:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230171AbjETADQ (ORCPT ); Fri, 19 May 2023 20:03:16 -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 9E01B10E6 for ; Fri, 19 May 2023 17:01:26 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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-ext4@vger.kernel.org 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 --- 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); }