diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2022-06-14 17:24:37 +0300 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2022-08-09 05:37:16 +0300 |
commit | 2dcedb2a549a4d7430538213b1b28ef7271bc0aa (patch) | |
tree | d6af7d3df8f6c016b030e119dda9ce915f421a2e /certs | |
parent | 0d9649341363047be60a9ec7378d8985bdd0abba (diff) | |
download | linux-2dcedb2a549a4d7430538213b1b28ef7271bc0aa.tar.xz |
ITER_PIPE: helper for getting pipe buffer by index
pipe_buffer instances of a pipe are organized as a ring buffer,
with power-of-2 size. Indices are kept *not* reduced modulo ring
size, so the buffer refered to by index N is
pipe->bufs[N & (pipe->ring_size - 1)].
Ring size can change over the lifetime of a pipe, but not while
the pipe is locked. So for any iov_iter primitives it's a constant.
Original conversion of pipes to this layout went overboard trying
to microoptimize that - calculating pipe->ring_size - 1, storing
it in a local variable and using through the function. In some
cases it might be warranted, but most of the times it only
obfuscates what's going on in there.
Introduce a helper (pipe_buf(pipe, N)) that would encapsulate
that and use it in the obvious cases. More will follow...
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'certs')
0 files changed, 0 insertions, 0 deletions