diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2010-05-20 04:43:18 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2010-05-21 15:12:40 -0400 |
commit | 35f3d14dbbc58447c61e38a162ea10add6b31dc7 (patch) | |
tree | 3e03cd540b7dcdac82195c4e76862c0ce6daaaf0 /include/linux | |
parent | 3d42b3612891baecf709d93f28655a6882a65d41 (diff) |
pipe: add support for shrinking and growing pipes
This patch adds F_GETPIPE_SZ and F_SETPIPE_SZ fcntl() actions for
growing and shrinking the size of a pipe and adjusts pipe.c and splice.c
(and relay and network splice) usage to work with these larger (or smaller)
pipes.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/fcntl.h | 6 | ||||
-rw-r--r-- | include/linux/pipe_fs_i.h | 11 | ||||
-rw-r--r-- | include/linux/splice.h | 7 |
3 files changed, 20 insertions, 4 deletions
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h index 86037400a6e3..afc00af3229b 100644 --- a/include/linux/fcntl.h +++ b/include/linux/fcntl.h | |||
@@ -22,6 +22,12 @@ | |||
22 | #define F_NOTIFY (F_LINUX_SPECIFIC_BASE+2) | 22 | #define F_NOTIFY (F_LINUX_SPECIFIC_BASE+2) |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * Set and get of pipe page size array | ||
26 | */ | ||
27 | #define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7) | ||
28 | #define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8) | ||
29 | |||
30 | /* | ||
25 | * Types of directory notifications that may be requested. | 31 | * Types of directory notifications that may be requested. |
26 | */ | 32 | */ |
27 | #define DN_ACCESS 0x00000001 /* File accessed */ | 33 | #define DN_ACCESS 0x00000001 /* File accessed */ |
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h index b43a9e039059..65f4282fcbaf 100644 --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | #define PIPEFS_MAGIC 0x50495045 | 4 | #define PIPEFS_MAGIC 0x50495045 |
5 | 5 | ||
6 | #define PIPE_BUFFERS (16) | 6 | #define PIPE_DEF_BUFFERS 16 |
7 | 7 | ||
8 | #define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */ | 8 | #define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */ |
9 | #define PIPE_BUF_FLAG_ATOMIC 0x02 /* was atomically mapped */ | 9 | #define PIPE_BUF_FLAG_ATOMIC 0x02 /* was atomically mapped */ |
@@ -44,17 +44,17 @@ struct pipe_buffer { | |||
44 | **/ | 44 | **/ |
45 | struct pipe_inode_info { | 45 | struct pipe_inode_info { |
46 | wait_queue_head_t wait; | 46 | wait_queue_head_t wait; |
47 | unsigned int nrbufs, curbuf; | 47 | unsigned int nrbufs, curbuf, buffers; |
48 | struct page *tmp_page; | ||
49 | unsigned int readers; | 48 | unsigned int readers; |
50 | unsigned int writers; | 49 | unsigned int writers; |
51 | unsigned int waiting_writers; | 50 | unsigned int waiting_writers; |
52 | unsigned int r_counter; | 51 | unsigned int r_counter; |
53 | unsigned int w_counter; | 52 | unsigned int w_counter; |
53 | struct page *tmp_page; | ||
54 | struct fasync_struct *fasync_readers; | 54 | struct fasync_struct *fasync_readers; |
55 | struct fasync_struct *fasync_writers; | 55 | struct fasync_struct *fasync_writers; |
56 | struct inode *inode; | 56 | struct inode *inode; |
57 | struct pipe_buffer bufs[PIPE_BUFFERS]; | 57 | struct pipe_buffer *bufs; |
58 | }; | 58 | }; |
59 | 59 | ||
60 | /* | 60 | /* |
@@ -154,4 +154,7 @@ int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *); | |||
154 | int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *); | 154 | int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *); |
155 | void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *); | 155 | void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *); |
156 | 156 | ||
157 | /* for F_SETPIPE_SZ and F_GETPIPE_SZ */ | ||
158 | long pipe_fcntl(struct file *, unsigned int, unsigned long arg); | ||
159 | |||
157 | #endif | 160 | #endif |
diff --git a/include/linux/splice.h b/include/linux/splice.h index 18e7c7c0cae6..997c3b4c212b 100644 --- a/include/linux/splice.h +++ b/include/linux/splice.h | |||
@@ -82,4 +82,11 @@ extern ssize_t splice_to_pipe(struct pipe_inode_info *, | |||
82 | extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *, | 82 | extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *, |
83 | splice_direct_actor *); | 83 | splice_direct_actor *); |
84 | 84 | ||
85 | /* | ||
86 | * for dynamic pipe sizing | ||
87 | */ | ||
88 | extern int splice_grow_spd(struct pipe_inode_info *, struct splice_pipe_desc *); | ||
89 | extern void splice_shrink_spd(struct pipe_inode_info *, | ||
90 | struct splice_pipe_desc *); | ||
91 | |||
85 | #endif | 92 | #endif |