summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-05-20 17:58:14 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2020-05-20 12:11:26 -0400
commit76887c256744740d6121af9bc4aa787712a1f694 (patch)
treea55b809de66779126d5821d90c35679c312875df
parent6797d97ab9d1b0ef94bf6063920669409dc2d730 (diff)
fs: make the pipe_buf_operations ->steal operation optional
Just return 1 for failure if it is not present. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/splice.c7
-rw-r--r--include/linux/pipe_fs_i.h3
-rw-r--r--kernel/trace/trace.c1
-rw-r--r--net/smc/smc_rx.c7
4 files changed, 2 insertions, 16 deletions
diff --git a/fs/splice.c b/fs/splice.c
index fb9670e7fc1f..6c19bda274c8 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -337,17 +337,10 @@ const struct pipe_buf_operations default_pipe_buf_ops = {
.get = generic_pipe_buf_get,
};
-int generic_pipe_buf_nosteal(struct pipe_inode_info *pipe,
- struct pipe_buffer *buf)
-{
- return 1;
-}
-
/* Pipe buffer operations for a socket and similar. */
const struct pipe_buf_operations nosteal_pipe_buf_ops = {
.confirm = generic_pipe_buf_confirm,
.release = generic_pipe_buf_release,
- .steal = generic_pipe_buf_nosteal,
.get = generic_pipe_buf_get,
};
EXPORT_SYMBOL(nosteal_pipe_buf_ops);
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index 3f7b07b38824..e022b2459301 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -206,6 +206,8 @@ static inline int pipe_buf_confirm(struct pipe_inode_info *pipe,
static inline int pipe_buf_steal(struct pipe_inode_info *pipe,
struct pipe_buffer *buf)
{
+ if (!buf->ops->steal)
+ return 1;
return buf->ops->steal(pipe, buf);
}
@@ -232,7 +234,6 @@ void free_pipe_info(struct pipe_inode_info *);
bool generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *);
int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *);
int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *);
-int generic_pipe_buf_nosteal(struct pipe_inode_info *, struct pipe_buffer *);
void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *);
extern const struct pipe_buf_operations nosteal_pipe_buf_ops;
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index bc9783797d27..29fa25cfb6c2 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -7576,7 +7576,6 @@ static bool buffer_pipe_buf_get(struct pipe_inode_info *pipe,
static const struct pipe_buf_operations buffer_pipe_buf_ops = {
.confirm = generic_pipe_buf_confirm,
.release = buffer_pipe_buf_release,
- .steal = generic_pipe_buf_nosteal,
.get = buffer_pipe_buf_get,
};
diff --git a/net/smc/smc_rx.c b/net/smc/smc_rx.c
index 39d7b34d06d2..5fe25279702d 100644
--- a/net/smc/smc_rx.c
+++ b/net/smc/smc_rx.c
@@ -129,16 +129,9 @@ out:
sock_put(sk);
}
-static int smc_rx_pipe_buf_nosteal(struct pipe_inode_info *pipe,
- struct pipe_buffer *buf)
-{
- return 1;
-}
-
static const struct pipe_buf_operations smc_pipe_ops = {
.confirm = generic_pipe_buf_confirm,
.release = smc_rx_pipe_buf_release,
- .steal = smc_rx_pipe_buf_nosteal,
.get = generic_pipe_buf_get
};