From patchwork Fri May 19 07:40:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13247760 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 069BCC77B7A for ; Fri, 19 May 2023 07:41:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 988E590000B; Fri, 19 May 2023 03:41:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 94280900003; Fri, 19 May 2023 03:41:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 78C8690000B; Fri, 19 May 2023 03:41:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 69C28900003 for ; Fri, 19 May 2023 03:41:27 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 3D5CD1609C2 for ; Fri, 19 May 2023 07:41:27 +0000 (UTC) X-FDA: 80806209414.29.F504B28 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf30.hostedemail.com (Postfix) with ESMTP id 925448000D for ; Fri, 19 May 2023 07:41:25 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=bLMgAMpI; spf=pass (imf30.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684482085; a=rsa-sha256; cv=none; b=BlBQmyxPQqqPDtu5cxsYyA4V+RTZWnxk8SX+GEO9vki/Azg0SkhoIL+ioT0WoeqJ6AkxMR oGCVphpwaD6e6MK/L4kTciHOcFsaFe+goCvG1zmY8okXscn8v+5Zct3Fhc+kVPo+CwlIVD RNeL4d47ySlPuxuis9qF5Kybfrdawnk= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=bLMgAMpI; spf=pass (imf30.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684482085; 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=ChgLSgSgCciGGEj2txPdAcXunor0ElTQJtr+fuEaFtA=; b=pbL6BnJw8uVt2Xb5uAJQtVfipzP6noLxMm2YqiLsJwa7h4qrfOIgNnW8TQnXiBnC2+rxNe Z/1QTyOxGQNPzealgw5e6GlcZMfmQaC/kOOxfPBNvAyMBCGPw8eicb9TMIWzyw/ZmisTpf yuHbESClaLtpnRwtMgspBwGTFEhABOg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684482084; 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=bLMgAMpIsVYMz8TJBPhEXzAnq2HPR8IS/mb78WVND7HX4uzTMCL9cyazAj6p1CXnYAZ/Iw RvMAQCGklDEu2euc32X5nYHjDH63BP4NG34+RLK9lbjdQc3f+lFqUTEmS/ilIc/tbumZrC 6+WscMEpCfY/i8yA3RRIamjXmJG5B60= 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 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 925448000D X-Stat-Signature: 7tgf6ubbta76ksmkkniz6t597x9anyam X-Rspam-User: X-HE-Tag: 1684482085-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wZDDOYh1KUxoxXNa9lZDntLAlpFp0ySqAvDIXOJBnpcWJ/dnustv6XQA/8P13QkvpZZah/WmGmgc3kDdOOBc/M727Pt5N15AGUkCj5raPRN+xOPllanMaGzsDZm+SDXXoFTot2G/h9bs9L7OosItH/rwRhk+0JP3yvGGmtLM+Z47SGsgKJWAuCOUCL6kgS28Z+iiGUie2MERaWCIxWRBGdFmhswg+iff6//beaWhM20/WGz+K9yU8PGo4x34Iik+yM6O1BAe3V7Z6wWkeUr5apcAgN5AnOsHq3hkduKd6FbHvjN5hAHl5LsELo75yxy+xTI4QFDgs4DAckIwtGbN9C48swQLsRe3h9NuDxZxN1eRbYvp3/AoUtZ/EXB+n5ffluHT/0KE3xTVRET5hFbw= 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 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;