Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3010989rwd; Mon, 22 May 2023 07:29:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Ck2Z/MzlTDtua8zIKscKsYSf5g8tBs0qO4CeG0gV58R2B37CmDqSEq2/18w46LOOS52IL X-Received: by 2002:a17:902:f545:b0:1ac:7405:d3ba with SMTP id h5-20020a170902f54500b001ac7405d3bamr14976815plf.40.1684765775840; Mon, 22 May 2023 07:29:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684765775; cv=none; d=google.com; s=arc-20160816; b=tR0YlUIWaiI3zO7DPDvdHM2J7dUW7SDFuFQGYJRoQvLVlgWNzmBDAu5+jCdhMdG6eM XyQcl0lQLompGnQOa7FVrpB/8vzN560PsXS8Ba92SYYifoOqvLJ1Iv4GonAUUWqlvaJS iBAkNMfXF8RvRkJtiBhnpHIfbLFwVZ4HHXoDIGqN8xFmTq19aGxda2h0bxUsNMeflZQE vfDzKNpKmJKJI3o5cLBEohyT8ZM76yRO5KHHe28YmlgeGm4p6gHgY1DhHAL9xoxrI9Fq cPomY91W5eZqr3deMVebEFuDFhQDefDcMITzMx8cK5BgMPL+t8F7aO809GCL2tZGpi8M TSgw== 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=1dW3gfal+wiqS1BsUQ7v1POUMzsncK8bE2BxQUdT+Fw=; b=S+gW2zozbyQlX30w8kwaD9AdPrGV1mml+7D6OfyM6jDRiFzyo2qkV+Dezc/mD6E8k6 BZusZ4m9rbc+KTOaayo0p3ogPzAMPsy811VbH7psvCZ1EPTrdVuc7JDcwmYkSV5BvFsF PsgdZrzSHmOLwxdb7M+u8hJd3FLEc57SdB1YogC656lRn1RpJplYZ/5mLZ9m0BD14dIi WAP0QPxVlyDEH3z8yOAXvcjaTv7+EADkqIo6I2WSk6RfzGCyXNqzBFyrivDzQWlzyyZD j9nvplHATRW4DVF1Deh8Ayt2GFpTHG7pu4Ybb6oJHPZgdHTjakUnOvtvfaEAsbR8q9LR tILg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IjfrVPTw; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x13-20020a170902ec8d00b001ab1d1a6803si3417090plg.420.2023.05.22.07.29.19; Mon, 22 May 2023 07:29:35 -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=IjfrVPTw; 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 S234459AbjEVN5L (ORCPT + 99 others); Mon, 22 May 2023 09:57:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234311AbjEVN44 (ORCPT ); Mon, 22 May 2023 09:56:56 -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 898FC10F8 for ; Mon, 22 May 2023 06:53:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684763550; 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=1dW3gfal+wiqS1BsUQ7v1POUMzsncK8bE2BxQUdT+Fw=; b=IjfrVPTwWf9h0pgVUifVFOusgyffmgP/cWgV5TQb2Dnc6KfG/uVV+8wXWpgYcwHfvWV4pD pJK3A7XP+38LijFZM5n10wj4H/MviMMona2ot7meW9pbXf3OMF3oIVaFY/H9UBkXs6Kmki CE8glafi5mZ16O8Nm0vBADOwrgBkNmY= 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-401-O78IS1gQNUW2bLyo8CEsOA-1; Mon, 22 May 2023 09:52:26 -0400 X-MC-Unique: O78IS1gQNUW2bLyo8CEsOA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 213773C025AD; Mon, 22 May 2023 13:52:25 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.39.192.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6AEE4140E95D; Mon, 22 May 2023 13:52:22 +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 , Steve French , linux-cifs@vger.kernel.org Subject: [PATCH v22 31/31] splice: kdoc for filemap_splice_read() and copy_splice_read() Date: Mon, 22 May 2023 14:50:18 +0100 Message-Id: <20230522135018.2742245-32-dhowells@redhat.com> In-Reply-To: <20230522135018.2742245-1-dhowells@redhat.com> References: <20230522135018.2742245-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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 Provide kerneldoc comments for filemap_splice_read() and copy_splice_read(). Signed-off-by: David Howells cc: Christian Brauner cc: Christoph Hellwig cc: Jens Axboe cc: Steve French cc: Al Viro cc: linux-mm@kvack.org cc: linux-block@vger.kernel.org cc: linux-cifs@vger.kernel.org cc: linux-fsdevel@vger.kernel.org --- fs/splice.c | 21 +++++++++++++++++++-- mm/filemap.c | 21 ++++++++++++++++++--- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/fs/splice.c b/fs/splice.c index 9be4cb3b9879..2420ead610a7 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -299,8 +299,25 @@ void splice_shrink_spd(struct splice_pipe_desc *spd) kfree(spd->partial); } -/* - * Copy data from a file into pages and then splice those into the output pipe. +/** + * copy_splice_read - Copy data from a file and splice the copy into a pipe + * @in: The file to read from + * @ppos: Pointer to the file position to read from + * @pipe: The pipe to splice into + * @len: The amount to splice + * @flags: The SPLICE_F_* flags + * + * This function allocates a bunch of pages sufficient to hold the requested + * amount of data (but limited by the remaining pipe capacity), passes it to + * the file's ->read_iter() to read into and then splices the used pages into + * the pipe. + * + * Return: On success, the number of bytes read will be returned and *@ppos + * will be updated if appropriate; 0 will be returned if there is no more data + * to be read; -EAGAIN will be returned if the pipe had no space, and some + * other negative error code will be returned on error. A short read may occur + * if the pipe has insufficient space, we reach the end of the data or we hit a + * hole. */ ssize_t copy_splice_read(struct file *in, loff_t *ppos, struct pipe_inode_info *pipe, diff --git a/mm/filemap.c b/mm/filemap.c index 603b562d69b1..f87e2ad8cff1 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2871,9 +2871,24 @@ size_t splice_folio_into_pipe(struct pipe_inode_info *pipe, return spliced; } -/* - * Splice folios from the pagecache of a buffered (ie. non-O_DIRECT) file into - * a pipe. +/** + * filemap_splice_read - Splice data from a file's pagecache into a pipe + * @in: The file to read from + * @ppos: Pointer to the file position to read from + * @pipe: The pipe to splice into + * @len: The amount to splice + * @flags: The SPLICE_F_* flags + * + * This function gets folios from a file's pagecache and splices them into the + * pipe. Readahead will be called as necessary to fill more folios. This may + * be used for blockdevs also. + * + * Return: On success, the number of bytes read will be returned and *@ppos + * will be updated if appropriate; 0 will be returned if there is no more data + * to be read; -EAGAIN will be returned if the pipe had no space, and some + * other negative error code will be returned on error. A short read may occur + * if the pipe has insufficient space, we reach the end of the data or we hit a + * hole. */ ssize_t filemap_splice_read(struct file *in, loff_t *ppos, struct pipe_inode_info *pipe,