Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2961529rwd; Mon, 22 May 2023 06:54:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4G+8exHp8T2Lrb0ZNz8p+JJY6v30Z38E7uF0ywThMjHmjHwnvs0QSwFIfjFuK4GQRs+OrQ X-Received: by 2002:a17:902:7fc9:b0:1ab:63e:67b0 with SMTP id t9-20020a1709027fc900b001ab063e67b0mr9637787plb.54.1684763644803; Mon, 22 May 2023 06:54:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684763644; cv=none; d=google.com; s=arc-20160816; b=FkmKcUEfgTEpvOPwzhvH9p8r5kkZvL2u6QleAIfO6vNzyxOw0C7TWc1DsIVcTSKDYB C9jYf93BNKL8ZFuqy5rnYY/bNn594sA2LI5g8wznI8Fi52Gc8r/v+fXRalWsT9gp76AG X0n5CX7nEbUXNUQihaJZcicAy1PeMCSHXGB8S6yMVORT0gekLXKG6uDTVX20lU2aE6YO 0OMLflsPIJzCEf6HZJOB3Ln3k6hpezK8tC6bzqO+EQBxfKBRsaquCQ6nQsHmHs5BA8X1 T40Kj/k7e/sDeXeT8Ys+4X4cIC1shdD3/vQ6bWQragDdl9rVvAfu19gcaEA4pivk1wi6 7ndQ== 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=9C/VFkhLRxHq1Y6ot9RmxNuYhTHdz11f1qiRk1qH2g0=; b=WGE5/TaN15BIIgy+x12/Q9pRADoQGq6HHg/HM1yT2fMrGkmjFRYRb5GhrqjI3A0Ul3 El8uN37yoblWop1nNChJs+NK0jIdI0NQ68id+ADRjdfMCF3UBm3eeNhRN3q/i3FXg98h LzarbkDDhniDmD/Y/Eu269eaZARDS2RkzczTiYqOlK/9xQQvVz+aZi6pH4J9Gc0vPdRx daPKFU8pmVPKKKXGHeQGsLlyYbcmUwHNs4t0ZZL5xB1PnkcCij32bLBIKpIwknbv/BZj JTbreD8gTzwpCm9W1eeUPEvpaIHafAq4XWBNFgBU2tNdXGLHq0pHFT+g1cx9/HHbTX2M xPAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=L3dGJWSX; 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 iw13-20020a170903044d00b0019e6e61c1bcsi4442683plb.9.2023.05.22.06.53.44; Mon, 22 May 2023 06:54:04 -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=L3dGJWSX; 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 S234075AbjEVNwt (ORCPT + 99 others); Mon, 22 May 2023 09:52:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233878AbjEVNwT (ORCPT ); Mon, 22 May 2023 09:52:19 -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 EAD15E4F for ; Mon, 22 May 2023 06:51:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684763461; 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=9C/VFkhLRxHq1Y6ot9RmxNuYhTHdz11f1qiRk1qH2g0=; b=L3dGJWSXj+9q+vUEsG3LXZrUguMDtTqa6gFj1ceFj+D1h+iuqbeR9gGm30G3R5w4vSK2Sx 9uvPEd/8ZJfnnTKe+4X5QuE4TStxX0/bmP31qtoTGlfnPhIaXGHsp1q+0zSogj2y5Awp1R FhYERUu4ZHwDG+MRUUugQfwMWGl2AxI= 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-628-yJ4lna96OoqIQQett0IxRw-1; Mon, 22 May 2023 09:50:58 -0400 X-MC-Unique: yJ4lna96OoqIQQett0IxRw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AA9502812946; Mon, 22 May 2023 13:50:56 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.39.192.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C7CF20296C6; Mon, 22 May 2023 13:50:52 +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 , Theodore Ts'o , Gao Xiang , linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH v22 08/31] splice: Make splice from a DAX file use copy_splice_read() Date: Mon, 22 May 2023 14:49:55 +0100 Message-Id: <20230522135018.2742245-9-dhowells@redhat.com> In-Reply-To: <20230522135018.2742245-1-dhowells@redhat.com> References: <20230522135018.2742245-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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 Reviewed-by: Christoph Hellwig Reviewed-by: Christian Brauner Reviewed-by: Theodore Ts'o Reviewed-by: Gao Xiang 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); }