Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fs: make the pipe_buf_operations ->confirm operation optional

Just return 0 for success if it is not present.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

authored by

Christoph Hellwig and committed by
Al Viro
b8d9e7f2 76887c25

+3 -25
-17
fs/pipe.c
··· 201 201 EXPORT_SYMBOL(generic_pipe_buf_get); 202 202 203 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 - 219 - /** 220 204 * generic_pipe_buf_release - put a reference to a &struct pipe_buffer 221 205 * @pipe: the pipe that the buffer belongs to 222 206 * @buf: the buffer to put a reference to ··· 216 232 EXPORT_SYMBOL(generic_pipe_buf_release); 217 233 218 234 static const struct pipe_buf_operations anon_pipe_buf_ops = { 219 - .confirm = generic_pipe_buf_confirm, 220 235 .release = anon_pipe_buf_release, 221 236 .steal = anon_pipe_buf_steal, 222 237 .get = generic_pipe_buf_get,
-3
fs/splice.c
··· 156 156 } 157 157 158 158 static const struct pipe_buf_operations user_page_pipe_buf_ops = { 159 - .confirm = generic_pipe_buf_confirm, 160 159 .release = page_cache_pipe_buf_release, 161 160 .steal = user_page_pipe_buf_steal, 162 161 .get = generic_pipe_buf_get, ··· 330 331 EXPORT_SYMBOL(generic_file_splice_read); 331 332 332 333 const struct pipe_buf_operations default_pipe_buf_ops = { 333 - .confirm = generic_pipe_buf_confirm, 334 334 .release = generic_pipe_buf_release, 335 335 .steal = generic_pipe_buf_steal, 336 336 .get = generic_pipe_buf_get, ··· 337 339 338 340 /* Pipe buffer operations for a socket and similar. */ 339 341 const struct pipe_buf_operations nosteal_pipe_buf_ops = { 340 - .confirm = generic_pipe_buf_confirm, 341 342 .release = generic_pipe_buf_release, 342 343 .get = generic_pipe_buf_get, 343 344 };
+3 -2
include/linux/pipe_fs_i.h
··· 82 82 * and that the contents are good. If the pages in the pipe belong 83 83 * to a file system, we may need to wait for IO completion in this 84 84 * 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. 86 86 */ 87 87 int (*confirm)(struct pipe_inode_info *, struct pipe_buffer *); 88 88 ··· 195 195 static inline int pipe_buf_confirm(struct pipe_inode_info *pipe, 196 196 struct pipe_buffer *buf) 197 197 { 198 + if (!buf->ops->confirm) 199 + return 0; 198 200 return buf->ops->confirm(pipe, buf); 199 201 } 200 202 ··· 234 232 235 233 /* Generic pipe buffer ops functions */ 236 234 bool generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *); 237 - int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *); 238 235 int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *); 239 236 void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *); 240 237
-1
kernel/relay.c
··· 1177 1177 } 1178 1178 1179 1179 static const struct pipe_buf_operations relay_pipe_buf_ops = { 1180 - .confirm = generic_pipe_buf_confirm, 1181 1180 .release = relay_pipe_buf_release, 1182 1181 .steal = generic_pipe_buf_steal, 1183 1182 .get = generic_pipe_buf_get,
-1
kernel/trace/trace.c
··· 7574 7574 7575 7575 /* Pipe buffer operations for a buffer. */ 7576 7576 static const struct pipe_buf_operations buffer_pipe_buf_ops = { 7577 - .confirm = generic_pipe_buf_confirm, 7578 7577 .release = buffer_pipe_buf_release, 7579 7578 .get = buffer_pipe_buf_get, 7580 7579 };
-1
net/smc/smc_rx.c
··· 130 130 } 131 131 132 132 static const struct pipe_buf_operations smc_pipe_ops = { 133 - .confirm = generic_pipe_buf_confirm, 134 133 .release = smc_rx_pipe_buf_release, 135 134 .get = generic_pipe_buf_get 136 135 };