From patchwork Mon May 22 13:49:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13250588 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 5FBDAC77B73 for ; Mon, 22 May 2023 13:51:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EDFE0280006; Mon, 22 May 2023 09:51:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E8EB7280002; Mon, 22 May 2023 09:51:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D07B6280006; Mon, 22 May 2023 09:51:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id C1EB3280002 for ; Mon, 22 May 2023 09:51:05 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A1F3C1A01E1 for ; Mon, 22 May 2023 13:51:05 +0000 (UTC) X-FDA: 80818027290.28.151D32F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf09.hostedemail.com (Postfix) with ESMTP id C284B140005 for ; Mon, 22 May 2023 13:51:02 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FBduurpm; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf09.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=1684763462; 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=9C/VFkhLRxHq1Y6ot9RmxNuYhTHdz11f1qiRk1qH2g0=; b=L01fa1bvWQA+yzaYYYuzOmByupVDVc9fg+uj9432zzrno69OMNWpJwRoAk4GF78uKLjIY/ gP0DCIEsOCXcfe8tcBVFULfeNri95GrrS7LvINU/CKE8uBJ3JrP1Dveyd61KjL4C8MLtA9 bDfVI/Fk52yXJrXKh/tlGL/GOBtUZvg= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FBduurpm; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf09.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=1684763462; a=rsa-sha256; cv=none; b=ZLmq6oLzrP3lIcjpipibk1NpDDqXYXROkK42lNOXMzdsZiJ9M1tTnIA7GEx15TNUBsu5wq Lqj9rxO4WYxXY1cm3w6OTXfmpr+bVjahcQ5Jur+QWN42f2R4N/fxAqYMtFdNocXBzU3hSF +ElmoTHgDUnfhCxSIlh01sCBZQvDBFU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684763462; 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=FBduurpmvEvzjEo9cCdSOWcxsg5Zz75aTinPNK86OehzivEtmg4w5HZYJJmhEuTD5BWbSI w/AlAKZY2/2+tmXxP3LWdchEJUlgHvLv0cFqONnn0vYDT4r4cLXgJfG/ZWM0y22s6sw6gK K5epBUiWFvoRjg22V6Nfe0BQzN3+dIE= 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 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Rspamd-Queue-Id: C284B140005 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 5ymszeoik53titmeer8crot5zjyec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GAuNnSMgDWn2DO3zU44Bg2Uk2A6NVkItOre2yllHyEBYzwx44VKRgUCpakMDCg7k5TcZtA2X3EN6yRi0y6APgkznGbb+W2ju/kVoYaBpPCTRHJ2097KJCNOqtuZhOIEaO37tYnZ97skPcKXbdgn7ksBBwhjvL/hDVW4ZpxyfUwKIbbJVS6KjVL/nQvbe/qs63pHlhNEcDS8B6ylBUtUkWjPncYdealBGkStJm2JHT8j56KOYhh9KTJU2IZCAISOUECO15hYfhEGuXcyrqucShrKQxyRUzAa8alz06p+mh+TeG3SryuhtbN+NZiBx1Vlabtl37RldvrtENTGbDKlh0QJOxQVzdG1do/J5RUmknejBkPPmPQj+Z0sr8/1z6hlyoFMVgNpEKzkL06m3DMN/6dnf9HrTiy2BO+Q96oynK1CH7RMxHaQ 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 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); }