Re: [PATCH 03/17] splice: Add a func to do a splice from an O_DIRECT file without ITER_PIPE
From: David Howells
Date: Fri Feb 17 2023 - 04:01:01 EST
David Howells <dhowells@xxxxxxxxxx> wrote:
> diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
> index 6cb65df3e3ba..d2c3f16cf6b1 100644
> --- a/include/linux/pipe_fs_i.h
> +++ b/include/linux/pipe_fs_i.h
> @@ -156,6 +156,26 @@ static inline bool pipe_full(unsigned int head, unsigned int tail,
> return pipe_occupancy(head, tail) >= limit;
> }
>
> +/**
> + * pipe_buf - Return the pipe buffer for the specified slot in the pipe ring
> + * @pipe: The pipe to access
> + * @slot: The slot of interest
> + */
> +static inline struct pipe_buffer *pipe_buf(const struct pipe_inode_info *pipe,
> + unsigned int slot)
> +{
> + return &pipe->bufs[slot & (pipe->ring_size - 1)];
> +}
> +
> +/**
> + * pipe_head_buf - Return the pipe buffer at the head of the pipe ring
> + * @pipe: The pipe to access
> + */
> +static inline struct pipe_buffer *pipe_head_buf(const struct pipe_inode_info *pipe)
> +{
> + return pipe_buf(pipe, pipe->head);
> +}
> +
> /**
> * pipe_buf_get - get a reference to a pipe_buffer
> * @pipe: the pipe that the buffer belongs to
> diff --git a/lib/iov_iter.c b/lib/iov_iter.c
> index f9a3ff37ecd1..47c484551c59 100644
> --- a/lib/iov_iter.c
> +++ b/lib/iov_iter.c
> @@ -186,12 +186,6 @@ static int copyin(void *to, const void __user *from, size_t n)
> return res;
> }
>
> -static inline struct pipe_buffer *pipe_buf(const struct pipe_inode_info *pipe,
> - unsigned int slot)
> -{
> - return &pipe->bufs[slot & (pipe->ring_size - 1)];
> -}
> -
> #ifdef PIPE_PARANOIA
> static bool sanity(const struct iov_iter *i)
> {
This needs moving to the previous patch, but no code change overall.
David