• Al Viro's avatar
    ITER_PIPE: helpers for adding pipe buffers · 47b7fcae
    Al Viro authored
    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: default avatarJeff Layton <jlayton@kernel.org>
    Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
    47b7fcae
iov_iter.c 49.3 KB