Message ID | 20230520000049.2226926-8-dhowells@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp49513vqo; Fri, 19 May 2023 17:23:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ51fveqCKaRNy4TXtcZ4g7JqT+7mhMMPvhqCZT0I8hUi3JtDy7vVbsGIuDZWdHTVLhaAlC1 X-Received: by 2002:a17:902:e80a:b0:1a9:a3b3:f935 with SMTP id u10-20020a170902e80a00b001a9a3b3f935mr4778223plg.57.1684542187461; Fri, 19 May 2023 17:23:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684542187; cv=none; d=google.com; s=arc-20160816; b=WoJcyNjfgZNSvxkB3ngf7fZLL0m4ytjp/MdfEqpJYtog8TktAjBKXnmtFPvE8lFX0V uoXacqLvgKw8xm6zaTh0S3AB+HgC03AwvFg485M4ypoovtmBd5hVTbe4dxgmUmS5COfd I02ZZTjS0/fRdSfBIaeKfTzCttm/9EmFysZs5/aUCVUdby420ktXysL0GhpM3zhDPDCF ygmpPUThQ23vNngWj0GYq0LIuP1iyrW5TADmUhXHwHhFDyLBg0D4ej5hqhJFQx+Fgt5F bdeC7x79AHXE3kCzDxM2Eqn8brjmC9dHTzMSq5VKpmi/aUS8HitdJFOARx6QfnnKKzES KsVA== 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=dIGb/7Nt7dNT7r5bxwMphLPrFmTGpxHZQXf9F5C0+vE=; b=zOxprJQEFhO97CZXeAZbT0TVVF3pTDl2IB1KjMnLz8Dhn51icXO4EZMz5CEu+GekD6 p+q0P51H+ocpr+cWyMqyV7SIY/jy90jzxL+4o7SuXHj1+pSPEJrBAk3+gqh9qZIJbhAO 5At5Urlq+GoT7wPaDH1kxS++nG/T7nPpQOfObDFI2not2T4KItiNwwWMZfmcujnwFZcV LPqEia63sRsaY8vm+kkbwLWxfcq1h9iTGDq9vZdl95ZcLhfri9cwzn32wYACDpYS1w89 Fg7q8BpQ6vaYXIeA3clk5zkJQ7ZpQJ6scPTgJmQRb2nTVkWWlIiR4yAWzN58XWUx10X8 CpFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AZwqWMR3; 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 ju9-20020a170903428900b001a81741ef8dsi189543plb.54.2023.05.19.17.22.46; Fri, 19 May 2023 17:23:07 -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=AZwqWMR3; 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 S229991AbjETADC (ORCPT <rfc822;wlfightup@gmail.com> + 99 others); Fri, 19 May 2023 20:03:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229958AbjETACy (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 19 May 2023 20:02:54 -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 CCBEB10D2 for <linux-kernel@vger.kernel.org>; Fri, 19 May 2023 17:01:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684540879; 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=dIGb/7Nt7dNT7r5bxwMphLPrFmTGpxHZQXf9F5C0+vE=; b=AZwqWMR3vFEGbXbDSBBUGJ4eIC4uHYrvxC/0Fjf/AD9ztuOWdpbfwq3bl7bxguL9pN/RAJ iB8bFiNXXBsvXG58ioLq1l+58JCjVh4VX7iH8WP7orFaN2+PxrWRojm6525h1bka+7CcYm xn/CHimXIl9OoWgNRCFMc1gQU3WTR58= 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-384-kv-DotIFPiO6JnwvLiQGkg-1; Fri, 19 May 2023 20:01:15 -0400 X-MC-Unique: kv-DotIFPiO6JnwvLiQGkg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4D7391C05EDC; Sat, 20 May 2023 00:01:14 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55785492B0A; Sat, 20 May 2023 00:01:12 +0000 (UTC) From: David Howells <dhowells@redhat.com> To: Jens Axboe <axboe@kernel.dk>, Al Viro <viro@zeniv.linux.org.uk>, Christoph Hellwig <hch@infradead.org> Cc: David Howells <dhowells@redhat.com>, Matthew Wilcox <willy@infradead.org>, Jan Kara <jack@suse.cz>, Jeff Layton <jlayton@kernel.org>, David Hildenbrand <david@redhat.com>, Jason Gunthorpe <jgg@nvidia.com>, Logan Gunthorpe <logang@deltatee.com>, Hillf Danton <hdanton@sina.com>, Christian Brauner <brauner@kernel.org>, Linus Torvalds <torvalds@linux-foundation.org>, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Christoph Hellwig <hch@lst.de> Subject: [PATCH v21 07/30] splice: Make splice from an O_DIRECT fd use copy_splice_read() Date: Sat, 20 May 2023 01:00:26 +0100 Message-Id: <20230520000049.2226926-8-dhowells@redhat.com> In-Reply-To: <20230520000049.2226926-1-dhowells@redhat.com> References: <20230520000049.2226926-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766370508752107706?= X-GMAIL-MSGID: =?utf-8?q?1766370508752107706?= |
Series |
splice: Kill ITER_PIPE
|
|
Commit Message
David Howells
May 20, 2023, midnight UTC
Make a read splice from a file descriptor that's open O_DIRECT use
copy_splice_read() to do the reading as filemap_splice_read() is unlikely
to find any pagecache to splice.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Christoph Hellwig <hch@lst.de>
cc: Al Viro <viro@zeniv.linux.org.uk>
cc: Jens Axboe <axboe@kernel.dk>
cc: linux-fsdevel@vger.kernel.org
cc: linux-block@vger.kernel.org
cc: linux-mm@kvack.org
---
Notes:
ver #21)
- Needs to be in vfs_splice_read(), not generic_file_splice_read().
fs/splice.c | 6 ++++++
1 file changed, 6 insertions(+)
Comments
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
On Sat, May 20, 2023 at 01:00:26AM +0100, David Howells wrote: > Make a read splice from a file descriptor that's open O_DIRECT use > copy_splice_read() to do the reading as filemap_splice_read() is unlikely > to find any pagecache to splice. > > Signed-off-by: David Howells <dhowells@redhat.com> > cc: Christoph Hellwig <hch@lst.de> > cc: Al Viro <viro@zeniv.linux.org.uk> > cc: Jens Axboe <axboe@kernel.dk> > cc: linux-fsdevel@vger.kernel.org > cc: linux-block@vger.kernel.org > cc: linux-mm@kvack.org > --- Reviewed-by: Christian Brauner <brauner@kernel.org>
diff --git a/fs/splice.c b/fs/splice.c index fe3309ffeb26..76126b1aafcb 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -907,6 +907,12 @@ 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. + */ + if ((in->f_flags & O_DIRECT)) + return copy_splice_read(in, ppos, pipe, len, flags); return in->f_op->splice_read(in, ppos, pipe, len, flags); } EXPORT_SYMBOL_GPL(vfs_splice_read);