Skip to content

Commit b8d9e7f

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

File tree

6 files changed

+3
-25
lines changed

6 files changed

+3
-25
lines changed

fs/pipe.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -200,22 +200,6 @@ bool generic_pipe_buf_get(struct pipe_inode_info *pipe, struct pipe_buffer *buf)
200200
}
201201
EXPORT_SYMBOL(generic_pipe_buf_get);
202202

203-
/**
204-
* generic_pipe_buf_confirm - verify contents of the pipe buffer
205-
* @info: the pipe that the buffer belongs to
206-
* @buf: the buffer to confirm
207-
*
208-
* Description:
209-
* This function does nothing, because the generic pipe code uses
210-
* pages that are always good when inserted into the pipe.
211-
*/
212-
int generic_pipe_buf_confirm(struct pipe_inode_info *info,
213-
struct pipe_buffer *buf)
214-
{
215-
return 0;
216-
}
217-
EXPORT_SYMBOL(generic_pipe_buf_confirm);
218-
219203
/**
220204
* generic_pipe_buf_release - put a reference to a &struct pipe_buffer
221205
* @pipe: the pipe that the buffer belongs to
@@ -232,7 +216,6 @@ void generic_pipe_buf_release(struct pipe_inode_info *pipe,
232216
EXPORT_SYMBOL(generic_pipe_buf_release);
233217

234218
static const struct pipe_buf_operations anon_pipe_buf_ops = {
235-
.confirm = generic_pipe_buf_confirm,
236219
.release = anon_pipe_buf_release,
237220
.steal = anon_pipe_buf_steal,
238221
.get = generic_pipe_buf_get,

fs/splice.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ static int user_page_pipe_buf_steal(struct pipe_inode_info *pipe,
156156
}
157157

158158
static const struct pipe_buf_operations user_page_pipe_buf_ops = {
159-
.confirm = generic_pipe_buf_confirm,
160159
.release = page_cache_pipe_buf_release,
161160
.steal = user_page_pipe_buf_steal,
162161
.get = generic_pipe_buf_get,
@@ -331,15 +330,13 @@ ssize_t generic_file_splice_read(struct file *in, loff_t *ppos,
331330
EXPORT_SYMBOL(generic_file_splice_read);
332331

333332
const struct pipe_buf_operations default_pipe_buf_ops = {
334-
.confirm = generic_pipe_buf_confirm,
335333
.release = generic_pipe_buf_release,
336334
.steal = generic_pipe_buf_steal,
337335
.get = generic_pipe_buf_get,
338336
};
339337

340338
/* Pipe buffer operations for a socket and similar. */
341339
const struct pipe_buf_operations nosteal_pipe_buf_ops = {
342-
.confirm = generic_pipe_buf_confirm,
343340
.release = generic_pipe_buf_release,
344341
.get = generic_pipe_buf_get,
345342
};

include/linux/pipe_fs_i.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ struct pipe_buf_operations {
8282
* and that the contents are good. If the pages in the pipe belong
8383
* to a file system, we may need to wait for IO completion in this
8484
* hook. Returns 0 for good, or a negative error value in case of
85-
* error.
85+
* error. If not present all pages are considered good.
8686
*/
8787
int (*confirm)(struct pipe_inode_info *, struct pipe_buffer *);
8888

@@ -195,6 +195,8 @@ static inline void pipe_buf_release(struct pipe_inode_info *pipe,
195195
static inline int pipe_buf_confirm(struct pipe_inode_info *pipe,
196196
struct pipe_buffer *buf)
197197
{
198+
if (!buf->ops->confirm)
199+
return 0;
198200
return buf->ops->confirm(pipe, buf);
199201
}
200202

@@ -232,7 +234,6 @@ void free_pipe_info(struct pipe_inode_info *);
232234

233235
/* Generic pipe buffer ops functions */
234236
bool generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *);
235-
int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *);
236237
int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *);
237238
void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *);
238239

kernel/relay.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,6 @@ static void relay_pipe_buf_release(struct pipe_inode_info *pipe,
11771177
}
11781178

11791179
static const struct pipe_buf_operations relay_pipe_buf_ops = {
1180-
.confirm = generic_pipe_buf_confirm,
11811180
.release = relay_pipe_buf_release,
11821181
.steal = generic_pipe_buf_steal,
11831182
.get = generic_pipe_buf_get,

kernel/trace/trace.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7574,7 +7574,6 @@ static bool buffer_pipe_buf_get(struct pipe_inode_info *pipe,
75747574

75757575
/* Pipe buffer operations for a buffer. */
75767576
static const struct pipe_buf_operations buffer_pipe_buf_ops = {
7577-
.confirm = generic_pipe_buf_confirm,
75787577
.release = buffer_pipe_buf_release,
75797578
.get = buffer_pipe_buf_get,
75807579
};

net/smc/smc_rx.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ static void smc_rx_pipe_buf_release(struct pipe_inode_info *pipe,
130130
}
131131

132132
static const struct pipe_buf_operations smc_pipe_ops = {
133-
.confirm = generic_pipe_buf_confirm,
134133
.release = smc_rx_pipe_buf_release,
135134
.get = generic_pipe_buf_get
136135
};

0 commit comments

Comments
 (0)