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
8#define PIPE_BUF_FLAG_ATOMIC 0x02 /* was atomically mapped */8#define PIPE_BUF_FLAG_ATOMIC 0x02 /* was atomically mapped */
9#define PIPE_BUF_FLAG_GIFT 0x04 /* page is a gift */9#define PIPE_BUF_FLAG_GIFT 0x04 /* page is a gift */
10#define PIPE_BUF_FLAG_PACKET 0x08 /* read() as a packet */10#define PIPE_BUF_FLAG_PACKET 0x08 /* read() as a packet */
11#define PIPE_BUF_FLAG_CAN_MERGE 0x10 /* can merge buffers */
11 12
12/**13/**
13 * struct pipe_buffer - a linux kernel pipe buffer14 * struct pipe_buffer - a linux kernel pipe buffer
@@ -69,11 +70,11 @@ struct pipe_inode_info { · 55 unmodified lines
69 * Note on the nesting of these functions:70 * Note on the nesting of these functions:
70 *71 *
71 * ->confirm()72 * ->confirm()
72 * ->steal()73 * ->try_steal()
73 *74 *
74 * That is, ->steal() must be called on a confirmed buffer.75 * That is, ->try_steal() must be called on a confirmed buffer. See below for
75 * See below for the meaning of each operation. Also see kerneldoc76 * the meaning of each operation. Also see the kerneldoc in fs/pipe.c for the
76 * in fs/pipe.c for the pipe and generic variants of these hooks.77 * pipe and generic variants of these hooks.
77 */78 */
78struct pipe_buf_operations {79struct pipe_buf_operations {
79 /*80 /*
@@ -81,7 +82,7 @@ struct pipe_buf_operations { · 1 unmodified line
81 * and that the contents are good. If the pages in the pipe belong82 * and that the contents are good. If the pages in the pipe belong
82 * to a file system, we may need to wait for IO completion in this83 * to a file system, we may need to wait for IO completion in this
83 * hook. Returns 0 for good, or a negative error value in case of84 * 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.
85 */86 */
86 int (*confirm)(struct pipe_inode_info *, struct pipe_buffer *);87 int (*confirm)(struct pipe_inode_info *, struct pipe_buffer *);
87 88
@@ -93,13 +94,13 @@ struct pipe_buf_operations { · 5 unmodified lines
93 94
94 /*95 /*
95 * Attempt to take ownership of the pipe buffer and its contents.96 * Attempt to take ownership of the pipe buffer and its contents.
96 * ->steal() returns 0 for success, in which case the contents97 * ->try_steal() returns %true for success, in which case the contents
97 * of the pipe (the buf->page) is locked and now completely owned98 * of the pipe (the buf->page) is locked and now completely owned by the
98 * by the caller. The page may then be transferred to a different99 * caller. The page may then be transferred to a different mapping, the
99 * mapping, the most often used case is insertion into different100 * most often used case is insertion into different file address space
100 * file address space cache.101 * cache.
101 */102 */
102 int (*steal)(struct pipe_inode_info *, struct pipe_buffer *);103 bool (*try_steal)(struct pipe_inode_info *, struct pipe_buffer *);
103 104
104 /*105 /*
105 * Get a reference to the pipe buffer.106 * 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
194static inline int pipe_buf_confirm(struct pipe_inode_info *pipe,195static inline int pipe_buf_confirm(struct pipe_inode_info *pipe,
195 struct pipe_buffer *buf)196 struct pipe_buffer *buf)
196{197{
198 if (!buf->ops->confirm)
199 return 0;
197 return buf->ops->confirm(pipe, buf);200 return buf->ops->confirm(pipe, buf);
198}201}
199 202
200/**203/**
201 * pipe_buf_steal - attempt to take ownership of a pipe_buffer204 * pipe_buf_try_steal - attempt to take ownership of a pipe_buffer
202 * @pipe: the pipe that the buffer belongs to205 * @pipe: the pipe that the buffer belongs to
203 * @buf: the buffer to attempt to steal206 * @buf: the buffer to attempt to steal
204 */207 */
205static inline int pipe_buf_steal(struct pipe_inode_info *pipe,208static inline bool pipe_buf_try_steal(struct pipe_inode_info *pipe,
206 struct pipe_buffer *buf)209 struct pipe_buffer *buf)
207{210{
208 return buf->ops->steal(pipe, buf);211 if (!buf->ops->try_steal)
212 return false;
213 return buf->ops->try_steal(pipe, buf);
209}214}
210 215
211/* Differs from PIPE_BUF in that PIPE_SIZE is the length of the actual216/* 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
229 234
230/* Generic pipe buffer ops functions */235/* Generic pipe buffer ops functions */
231bool generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *);236bool generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *);
232int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *);237bool generic_pipe_buf_try_steal(struct pipe_inode_info *, struct pipe_buffer *);
233int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *);
234int generic_pipe_buf_nosteal(struct pipe_inode_info *, struct pipe_buffer *);
235void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *);238void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *);
236void pipe_buf_mark_unmergeable(struct pipe_buffer *buf);
237 239
238extern const struct pipe_buf_operations nosteal_pipe_buf_ops;240extern const struct pipe_buf_operations nosteal_pipe_buf_ops;
239 241

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