From patchwork Sat May 20 00:00:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 96700 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp70035vqo; Fri, 19 May 2023 18:20:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5XeEL3GFxRbwme6lhHqO7qDH79HSCNlRtj3HW+sKXwoQVG3nxdjcXpv87B8ziE34sP4GXh X-Received: by 2002:a17:902:ab4e:b0:1ae:4ddd:9961 with SMTP id ij14-20020a170902ab4e00b001ae4ddd9961mr4575068plb.20.1684545640237; Fri, 19 May 2023 18:20:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684545640; cv=none; d=google.com; s=arc-20160816; b=oDJdUXc9bcU4kgAIH4lq0EqbqSneqORCfq0nj8LF1/pkc/7PZd5fVisuC2lM0vS3DV rc8cTjE9fQh0MJ8DRyuedjzY0Le5D/QHCY3fSh1CyNMTcC6VymT4PKs6M+z8s8uvYyM2 3UuQdkBnAvqUPIcFwxGiXCczRBGggDRPK5DTJrdh+3ob8wsyQozJLH9EOEaewwDYjncA 8qUv1WFKdqUaJDI/ZKi8i2F0qcgM50yBi0IENgG5MJltvgLGqzf4oexR/Lto04i+Zl1k EOs0bl5zV503F+b1czxAhR1hZEwUPV/uXlHvr145XcW0bdST15RsVDm2175sTnlh69mN rZZQ== 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=WL9H5U9UPN37+g8PURz79ke6B0CrynxvP46sfk0da1732B5k4q+8kis8gFm4+eBm9z PO+ptVbth33QMDNAiJk+pGaN8LTOgMT8FkQrkaXNjc+TjJVay29ZX883jQkgDm+hhjqa 259VfjkSIxhHKITTp0AFD3WwoDXJPVPlGr7oVMapvtCScm6+HICaXtAyKKnHUhSXSqP3 FAvpQT1nCxYCRjJwtKK4tZK2DjD3y4fjG4+mN66L+bK8PhU8Hy4VAC974iozkPPKhIro M8NrG9iZ+Uyj+G+iiybwbzBmAN5pGuJ9X6N3gamXUyQCXso96jWhyNbxrECiRC99k0LR Clsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JmP4XGNy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j4-20020a170902c08400b001adc5bc4d8asi419651pld.572.2023.05.19.18.20.26; Fri, 19 May 2023 18:20:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=JmP4XGNy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S230100AbjETADP (ORCPT + 99 others); Fri, 19 May 2023 20:03:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229951AbjETADL (ORCPT ); Fri, 19 May 2023 20:03:11 -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 A9BAA10DC for ; Fri, 19 May 2023 17:01:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684540881; 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=JmP4XGNyGgit4jbkTTpdcrotO90zcTeSqumnmA2shiPCuGOTIre7Szq4gHFMGWSqVNse8z SSV0n+NdnJUrALjRinaAxYgLvD1BR6YiY1WFJcHOvP/y3hEbetn2NLekt8SWM0fa7nx3CP yOp0JCfoabx2bk3NX6lqO2SLPfq/oas= 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 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766374129160513758?= X-GMAIL-MSGID: =?utf-8?q?1766374129160513758?= 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 Reviewed-by: Christoph Hellwig Reviewed-by: Christian Brauner Reviewed-by: Theodore Ts'o Reviewed-by: Gao Xiang --- 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); }