]> git.baikalelectronics.ru Git - kernel.git/commit
ITER_PIPE: helpers for adding pipe buffers
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 13 Jun 2022 18:30:15 +0000 (14:30 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 9 Aug 2022 02:37:16 +0000 (22:37 -0400)
commite5dd43e7380cdeb2f37876df4d45b9a1bdd036ee
treefb6fc1b6d11438ca0b0b463133b5e80351b5dc57
parent652009372d66b123b946f729f2057a924eca6e9c
ITER_PIPE: helpers for adding pipe buffers

There are only two kinds of pipe_buffer in the area used by ITER_PIPE.

1) anonymous - copy_to_iter() et.al. end up creating those and copying
data there.  They have zero ->offset, and their ->ops points to
default_pipe_page_ops.

2) zero-copy ones - those come from copy_page_to_iter(), and page
comes from caller.  ->offset is also caller-supplied - it might be
non-zero.  ->ops points to page_cache_pipe_buf_ops.

Move creation and insertion of those into helpers - push_anon(pipe, size)
and push_page(pipe, page, offset, size) resp., separating them from
the "could we avoid creating a new buffer by merging with the current
head?" logics.

Acked-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
lib/iov_iter.c