History

Merge branch 'work.splice' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull splice updates from Al Viro: "Christoph's assorted splice cleanups" * 'work.splice' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: fs: rename pipe_buf ->steal to ->try_steal fs: make the pipe_buf_operations ->confirm operation optional fs: make the pipe_buf_operations ->steal operation optional trace: remove tracing_pipe_buf_ops pipe: merge anon_pipe_buf*_ops fs: simplify do_splice_from fs: simplify do_splice_to

Linus Torvalds committed 6 years ago

Commit ae03c532 parents 039aeb9 c928f648 files · +77 −170Browse files

Showing the changes to include/linux (1 of 8 files). Show all

Unified · Split

include/linux/pipe_fs_i.h+21−19
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #define PIPE_BUF_FLAG_ATOMIC 0x02 /* was atomically mapped */
99 #define PIPE_BUF_FLAG_GIFT 0x04 /* page is a gift */
1010 #define PIPE_BUF_FLAG_PACKET 0x08 /* read() as a packet */
11+#define PIPE_BUF_FLAG_CAN_MERGE 0x10 /* can merge buffers */
1112
1213 /**
1314 * struct pipe_buffer - a linux kernel pipe buffer
@@ -69,11 +70,11 @@ struct pipe_inode_info { · 55 unmodified lines
6970 * Note on the nesting of these functions:
7071 *
7172 * ->confirm()
72− * ->steal()
73+ * ->try_steal()
7374 *
74− * That is, ->steal() must be called on a confirmed buffer.
75− * See below for the meaning of each operation. Also see kerneldoc
76− * in fs/pipe.c for the pipe and generic variants of these hooks.
75+ * That is, ->try_steal() must be called on a confirmed buffer. See below for
76+ * the meaning of each operation. Also see the kerneldoc in fs/pipe.c for the
77+ * pipe and generic variants of these hooks.
7778 */
7879 struct pipe_buf_operations {
7980 /*
@@ -81,7 +82,7 @@ struct pipe_buf_operations { · 1 unmodified line
8182 * and that the contents are good. If the pages in the pipe belong
8283 * to a file system, we may need to wait for IO completion in this
8384 * hook. Returns 0 for good, or a negative error value in case of
84− * error.
85+ * error. If not present all pages are considered good.
8586 */
8687 int (*confirm)(struct pipe_inode_info *, struct pipe_buffer *);
8788
@@ -93,13 +94,13 @@ struct pipe_buf_operations { · 5 unmodified lines
9394
9495 /*
9596 * Attempt to take ownership of the pipe buffer and its contents.
96− * ->steal() returns 0 for success, in which case the contents
97− * of the pipe (the buf->page) is locked and now completely owned
98− * by the caller. The page may then be transferred to a different
99− * mapping, the most often used case is insertion into different
100− * file address space cache.
97+ * ->try_steal() returns %true for success, in which case the contents
98+ * of the pipe (the buf->page) is locked and now completely owned by the
99+ * caller. The page may then be transferred to a different mapping, the
100+ * most often used case is insertion into different file address space
101+ * cache.
101102 */
102− int (*steal)(struct pipe_inode_info *, struct pipe_buffer *);
103+ bool (*try_steal)(struct pipe_inode_info *, struct pipe_buffer *);
103104
104105 /*
105106 * Get a reference to the pipe buffer.
@@ -194,18 +195,22 @@ static inline void pipe_buf_release(struct pipe_inode_info *pipe, · 88 unmodified lines
194195 static inline int pipe_buf_confirm(struct pipe_inode_info *pipe,
195196 struct pipe_buffer *buf)
196197 {
198+ if (!buf->ops->confirm)
199+ return 0;
197200 return buf->ops->confirm(pipe, buf);
198201 }
199202
200203 /**
201− * pipe_buf_steal - attempt to take ownership of a pipe_buffer
204+ * pipe_buf_try_steal - attempt to take ownership of a pipe_buffer
202205 * @pipe: the pipe that the buffer belongs to
203206 * @buf: the buffer to attempt to steal
204207 */
205−static inline int pipe_buf_steal(struct pipe_inode_info *pipe,
206− struct pipe_buffer *buf)
208+static inline bool pipe_buf_try_steal(struct pipe_inode_info *pipe,
209+ struct pipe_buffer *buf)
207210 {
208− return buf->ops->steal(pipe, buf);
211+ if (!buf->ops->try_steal)
212+ return false;
213+ return buf->ops->try_steal(pipe, buf);
209214 }
210215
211216 /* Differs from PIPE_BUF in that PIPE_SIZE is the length of the actual
@@ -229,11 +234,8 @@ void free_pipe_info(struct pipe_inode_info *); · 17 unmodified lines
229234
230235 /* Generic pipe buffer ops functions */
231236 bool generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *);
232−int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *);
233−int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *);
234−int generic_pipe_buf_nosteal(struct pipe_inode_info *, struct pipe_buffer *);
237+bool generic_pipe_buf_try_steal(struct pipe_inode_info *, struct pipe_buffer *);
235238 void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *);
236−void pipe_buf_mark_unmergeable(struct pipe_buffer *buf);
237239
238240 extern const struct pipe_buf_operations nosteal_pipe_buf_ops;
239241

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t