Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 9eee8bd

Browse files
dhowellsaxboe
authored andcommitted
splice: kdoc for filemap_splice_read() and copy_splice_read()
Provide kerneldoc comments for filemap_splice_read() and copy_splice_read(). Signed-off-by: David Howells <[email protected]> cc: Christian Brauner <[email protected]> cc: Christoph Hellwig <[email protected]> cc: Jens Axboe <[email protected]> cc: Steve French <[email protected]> cc: Al Viro <[email protected]> cc: [email protected] cc: [email protected] cc: [email protected] cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 3fc4026 commit 9eee8bd

File tree

2 files changed

+37
-5
lines changed

2 files changed

+37
-5
lines changed

fs/splice.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,25 @@ void splice_shrink_spd(struct splice_pipe_desc *spd)
299299
kfree(spd->partial);
300300
}
301301

302-
/*
303-
* Copy data from a file into pages and then splice those into the output pipe.
302+
/**
303+
* copy_splice_read - Copy data from a file and splice the copy into a pipe
304+
* @in: The file to read from
305+
* @ppos: Pointer to the file position to read from
306+
* @pipe: The pipe to splice into
307+
* @len: The amount to splice
308+
* @flags: The SPLICE_F_* flags
309+
*
310+
* This function allocates a bunch of pages sufficient to hold the requested
311+
* amount of data (but limited by the remaining pipe capacity), passes it to
312+
* the file's ->read_iter() to read into and then splices the used pages into
313+
* the pipe.
314+
*
315+
* Return: On success, the number of bytes read will be returned and *@ppos
316+
* will be updated if appropriate; 0 will be returned if there is no more data
317+
* to be read; -EAGAIN will be returned if the pipe had no space, and some
318+
* other negative error code will be returned on error. A short read may occur
319+
* if the pipe has insufficient space, we reach the end of the data or we hit a
320+
* hole.
304321
*/
305322
ssize_t copy_splice_read(struct file *in, loff_t *ppos,
306323
struct pipe_inode_info *pipe,

mm/filemap.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2871,9 +2871,24 @@ size_t splice_folio_into_pipe(struct pipe_inode_info *pipe,
28712871
return spliced;
28722872
}
28732873

2874-
/*
2875-
* Splice folios from the pagecache of a buffered (ie. non-O_DIRECT) file into
2876-
* a pipe.
2874+
/**
2875+
* filemap_splice_read - Splice data from a file's pagecache into a pipe
2876+
* @in: The file to read from
2877+
* @ppos: Pointer to the file position to read from
2878+
* @pipe: The pipe to splice into
2879+
* @len: The amount to splice
2880+
* @flags: The SPLICE_F_* flags
2881+
*
2882+
* This function gets folios from a file's pagecache and splices them into the
2883+
* pipe. Readahead will be called as necessary to fill more folios. This may
2884+
* be used for blockdevs also.
2885+
*
2886+
* Return: On success, the number of bytes read will be returned and *@ppos
2887+
* will be updated if appropriate; 0 will be returned if there is no more data
2888+
* to be read; -EAGAIN will be returned if the pipe had no space, and some
2889+
* other negative error code will be returned on error. A short read may occur
2890+
* if the pipe has insufficient space, we reach the end of the data or we hit a
2891+
* hole.
28772892
*/
28782893
ssize_t filemap_splice_read(struct file *in, loff_t *ppos,
28792894
struct pipe_inode_info *pipe,

0 commit comments

Comments
 (0)