ITER_PIPE: allocate buffers as we go in copy-to-pipe primitives
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 14 Jun 2022 17:53:53 +0000 (13:53 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 19 Jul 2022 17:08:46 +0000 (13:08 -0400)
commit15b8cc2e26f23de17d0e73221c1be2d818260032
tree3ec39ee37c0ed93bdbbe08d96621e1ea02876ba6
parent37e98add90d75564800de7a3603f3cb5a1890dc6
ITER_PIPE: allocate buffers as we go in copy-to-pipe primitives

New helper: append_pipe().  Extends the last buffer if possible,
allocates a new one otherwise.  Returns page and offset in it
on success, NULL on failure.  iov_iter is advanced past the
data we've got.

Use that instead of push_pipe() in copy-to-pipe primitives;
they get simpler that way.  Handling of short copy (in "mc" one)
is done simply by iov_iter_revert() - iov_iter is in consistent
state after that one, so we can use that.

[Fix for braino caught by Liu Xinpeng <liuxp11@chinatelecom.cn> folded in]

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