Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2107792rwd; Fri, 19 May 2023 00:43:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7oO9wrB/Bi8jzgLPNTHerdHwRrMphvr8u2vEhp1vXcsB57xSm7LAgwtYVc4dm0T87ocofn X-Received: by 2002:a05:6a20:431f:b0:ff:f746:1044 with SMTP id h31-20020a056a20431f00b000fff7461044mr1127515pzk.53.1684482213257; Fri, 19 May 2023 00:43:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684482213; cv=none; d=google.com; s=arc-20160816; b=JcOzsMVJuxKJGWlG/oGPmgx5TBNipdaRojLA4JwUW7RDk1fydqjrkVa+Q8k/7EcVY8 BwLfLGo/RpIsn5RzOpGbXfTJQ1VSFDzkg7wWbFM6XfAUQyyZykn5MoOr0Mmwz3fVMxal B7ZxGrH+NhYa0stPpvrn2dHG4pxziF0OsBkqg5Dv+jURrwu6/S2Hhxd/N8xTv1S/dxDH qZldvDsfRdpyhpIk+h3pLJQzIeYNKz0LbqD3K3UOBxQCD35/vrtRr9zl6Ch/knRLdewr tv1i9l4ZuRCl0T2yH8WoQqtg0drzMSYxFrObxbEEqI0nLr4VmN+dqPd8kplNgRSQxwzD mApw== 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=ChgLSgSgCciGGEj2txPdAcXunor0ElTQJtr+fuEaFtA=; b=vKRaHFPm3PI53Om/pcO25Jj4+e08Ge7Zk5b6I/tDbIi910KqXquxwDe8m33CKZwQa3 ekT0qpsLTa4v8Xm8s4VXt2Mw0P26SM8T4VKgunLQxmZ5Z9wAzHyzj4WBOrpi5a8zltC8 2fnNXUZcv4hzVXBggqWi/fv7jHRVOW9NSE0WX2b9NBCjo9uT7VtFBMjoWyogNgzBpfFf cjgkAYgJAmSH7Y/HPY3OedbVWXtZ8st+8HPCN7PBtM688J4Ri6dbUC2ocRYS+UYoEnXq nLCFSJbNjrCHDGq2h5O/Fk9prB/dy5pdAVLI5ZrvawsITBpbh96lfLIHM8kwCFDkfDK4 58/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Z7N+/28Q"; 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 h185-20020a6383c2000000b00528b49eacf1si2596489pge.135.2023.05.19.00.43.04; Fri, 19 May 2023 00:43:33 -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="Z7N+/28Q"; 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 S230448AbjESHmM (ORCPT + 99 others); Fri, 19 May 2023 03:42:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230398AbjESHmL (ORCPT ); Fri, 19 May 2023 03:42:11 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7363710E0 for ; Fri, 19 May 2023 00:41:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684482083; 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=ChgLSgSgCciGGEj2txPdAcXunor0ElTQJtr+fuEaFtA=; b=Z7N+/28QuH4ugBzdz/HWW6uPoGjQpwY6rqa39rhP3J2Y0hG5I2HTWwRT/L/jzk8sOIwLWO PQV3CxOcSgPgcnl3pc22sPACSoJST6EdV+NyOBEZHcHesi+F6siVcwDemMrbbuVq6yb91n g9yU9+rhx4xcFpGU3s03l3LNu0bQ87k= 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-673-2UnIjJkHPT6ZoSIApCo6vg-1; Fri, 19 May 2023 03:41:20 -0400 X-MC-Unique: 2UnIjJkHPT6ZoSIApCo6vg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3C96E101A58B; Fri, 19 May 2023 07:41:19 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id D833E2166B27; Fri, 19 May 2023 07:41:16 +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 v20 05/32] splice: Make splice from a DAX file use direct_splice_read() Date: Fri, 19 May 2023 08:40:20 +0100 Message-Id: <20230519074047.1739879-6-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.6 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, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 direct_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-fsdevel@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 --- fs/splice.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/splice.c b/fs/splice.c index 1e0b7c7038b5..7b818b5b18d4 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -421,6 +421,11 @@ ssize_t generic_file_splice_read(struct file *in, loff_t *ppos, struct kiocb kiocb; int ret; +#ifdef CONFIG_FS_DAX + if (IS_DAX(in->f_mapping->host)) + return direct_splice_read(in, ppos, pipe, len, flags); +#endif + iov_iter_pipe(&to, ITER_DEST, pipe, len); init_sync_kiocb(&kiocb, in); kiocb.ki_pos = *ppos;