Skip to content

Commit 76887c2

Browse files
Christoph HellwigAl Viro
authored andcommitted
fs: make the pipe_buf_operations ->steal operation optional
Just return 1 for failure if it is not present. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 6797d97 commit 76887c2

File tree

4 files changed

+2
-16
lines changed

4 files changed

+2
-16
lines changed

fs/splice.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -337,17 +337,10 @@ const struct pipe_buf_operations default_pipe_buf_ops = {
337337
.get = generic_pipe_buf_get,
338338
};
339339

340-
int generic_pipe_buf_nosteal(struct pipe_inode_info *pipe,
341-
struct pipe_buffer *buf)
342-
{
343-
return 1;
344-
}
345-
346340
/* Pipe buffer operations for a socket and similar. */
347341
const struct pipe_buf_operations nosteal_pipe_buf_ops = {
348342
.confirm = generic_pipe_buf_confirm,
349343
.release = generic_pipe_buf_release,
350-
.steal = generic_pipe_buf_nosteal,
351344
.get = generic_pipe_buf_get,
352345
};
353346
EXPORT_SYMBOL(nosteal_pipe_buf_ops);

include/linux/pipe_fs_i.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ static inline int pipe_buf_confirm(struct pipe_inode_info *pipe,
206206
static inline int pipe_buf_steal(struct pipe_inode_info *pipe,
207207
struct pipe_buffer *buf)
208208
{
209+
if (!buf->ops->steal)
210+
return 1;
209211
return buf->ops->steal(pipe, buf);
210212
}
211213

@@ -232,7 +234,6 @@ void free_pipe_info(struct pipe_inode_info *);
232234
bool generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *);
233235
int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *);
234236
int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *);
235-
int generic_pipe_buf_nosteal(struct pipe_inode_info *, struct pipe_buffer *);
236237
void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *);
237238

238239
extern const struct pipe_buf_operations nosteal_pipe_buf_ops;

kernel/trace/trace.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7576,7 +7576,6 @@ static bool buffer_pipe_buf_get(struct pipe_inode_info *pipe,
75767576
static const struct pipe_buf_operations buffer_pipe_buf_ops = {
75777577
.confirm = generic_pipe_buf_confirm,
75787578
.release = buffer_pipe_buf_release,
7579-
.steal = generic_pipe_buf_nosteal,
75807579
.get = buffer_pipe_buf_get,
75817580
};
75827581

net/smc/smc_rx.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,9 @@ static void smc_rx_pipe_buf_release(struct pipe_inode_info *pipe,
129129
sock_put(sk);
130130
}
131131

132-
static int smc_rx_pipe_buf_nosteal(struct pipe_inode_info *pipe,
133-
struct pipe_buffer *buf)
134-
{
135-
return 1;
136-
}
137-
138132
static const struct pipe_buf_operations smc_pipe_ops = {
139133
.confirm = generic_pipe_buf_confirm,
140134
.release = smc_rx_pipe_buf_release,
141-
.steal = smc_rx_pipe_buf_nosteal,
142135
.get = generic_pipe_buf_get
143136
};
144137

0 commit comments

Comments
 (0)