]> git.baikalelectronics.ru Git - kernel.git/commit
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, 9 Aug 2022 02:37:17 +0000 (22:37 -0400)
commit84e3763b083628f0cab3dd4a5e4bb2a54050c352
tree87018b8809edaa081c98a00fd11a252b4ec685b9
parente5dd43e7380cdeb2f37876df4d45b9a1bdd036ee
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]
[another braino fix, this time in copy_pipe_to_iter() and pipe_zero();
caught by testcase from Hugh Dickins]

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