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, 19 Jul 2022 17:08:46 +0000 (13:08 -0400)
commit37e98add90d75564800de7a3603f3cb5a1890dc6
tree9c5ce8ca01f47755beb54281d65dd6129e20f5c5
parentc4a5436c3ad9d9934bad3783656c4d392ad3d1d1
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