aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-06-14 07:10:48 -0400
committerJens Axboe <jens.axboe@oracle.com>2007-07-10 02:04:15 -0400
commitcac36bb06efe4880234524e117e0e712b10b1f16 (patch)
tree5220c6f2185cee1c6934cf8048975beac5bc94bb
parentd96e6e71647846e0dab097efd9b8bf3a3a556dca (diff)
pipe: change the ->pin() operation to ->confirm()
The name 'pin' was badly chosen, it doesn't pin a pipe buffer in the most commonly used sense in the kernel. So change the name to 'confirm', after debating this issue with Hugh Dickins a bit. A good return from ->confirm() means that the buffer is really there, and that the contents are good. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--drivers/block/loop.c2
-rw-r--r--fs/nfsd/vfs.c2
-rw-r--r--fs/ocfs2/file.c4
-rw-r--r--fs/pipe.c9
-rw-r--r--fs/splice.c14
-rw-r--r--include/linux/pipe_fs_i.h9
-rw-r--r--kernel/relay.c2
7 files changed, 22 insertions, 20 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 08f53df03e8c..4503290da407 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -412,7 +412,7 @@ lo_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
412 size_t size; 412 size_t size;
413 int ret; 413 int ret;
414 414
415 ret = buf->ops->pin(pipe, buf); 415 ret = buf->ops->confirm(pipe, buf);
416 if (unlikely(ret)) 416 if (unlikely(ret))
417 return ret; 417 return ret;
418 418
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 8176fbf5c006..8604e35bd48e 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -815,7 +815,7 @@ nfsd_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
815 size_t size; 815 size_t size;
816 int ret; 816 int ret;
817 817
818 ret = buf->ops->pin(pipe, buf); 818 ret = buf->ops->confirm(pipe, buf);
819 if (unlikely(ret)) 819 if (unlikely(ret))
820 return ret; 820 return ret;
821 821
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 44c2e2afa465..4979b6675717 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1583,7 +1583,7 @@ static int ocfs2_splice_write_actor(struct pipe_inode_info *pipe,
1583 ssize_t copied = 0; 1583 ssize_t copied = 0;
1584 struct ocfs2_splice_write_priv sp; 1584 struct ocfs2_splice_write_priv sp;
1585 1585
1586 ret = buf->ops->pin(pipe, buf); 1586 ret = buf->ops->confirm(pipe, buf);
1587 if (ret) 1587 if (ret)
1588 goto out; 1588 goto out;
1589 1589
@@ -1604,7 +1604,7 @@ static int ocfs2_splice_write_actor(struct pipe_inode_info *pipe,
1604 * might enter ocfs2_buffered_write_cluster() more 1604 * might enter ocfs2_buffered_write_cluster() more
1605 * than once, so keep track of our progress here. 1605 * than once, so keep track of our progress here.
1606 */ 1606 */
1607 copied = ocfs2_buffered_write_cluster(sd->file, 1607 copied = ocfs2_buffered_write_cluster(sd->u.file,
1608 (loff_t)sd->pos + total, 1608 (loff_t)sd->pos + total,
1609 count, 1609 count,
1610 ocfs2_map_and_write_splice_data, 1610 ocfs2_map_and_write_splice_data,
diff --git a/fs/pipe.c b/fs/pipe.c
index 3a89592bdf57..3694af10dd2c 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -203,7 +203,8 @@ void generic_pipe_buf_get(struct pipe_inode_info *info, struct pipe_buffer *buf)
203 page_cache_get(buf->page); 203 page_cache_get(buf->page);
204} 204}
205 205
206int generic_pipe_buf_pin(struct pipe_inode_info *info, struct pipe_buffer *buf) 206int generic_pipe_buf_confirm(struct pipe_inode_info *info,
207 struct pipe_buffer *buf)
207{ 208{
208 return 0; 209 return 0;
209} 210}
@@ -212,7 +213,7 @@ static const struct pipe_buf_operations anon_pipe_buf_ops = {
212 .can_merge = 1, 213 .can_merge = 1,
213 .map = generic_pipe_buf_map, 214 .map = generic_pipe_buf_map,
214 .unmap = generic_pipe_buf_unmap, 215 .unmap = generic_pipe_buf_unmap,
215 .pin = generic_pipe_buf_pin, 216 .confirm = generic_pipe_buf_confirm,
216 .release = anon_pipe_buf_release, 217 .release = anon_pipe_buf_release,
217 .steal = generic_pipe_buf_steal, 218 .steal = generic_pipe_buf_steal,
218 .get = generic_pipe_buf_get, 219 .get = generic_pipe_buf_get,
@@ -252,7 +253,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov,
252 if (chars > total_len) 253 if (chars > total_len)
253 chars = total_len; 254 chars = total_len;
254 255
255 error = ops->pin(pipe, buf); 256 error = ops->confirm(pipe, buf);
256 if (error) { 257 if (error) {
257 if (!ret) 258 if (!ret)
258 error = ret; 259 error = ret;
@@ -373,7 +374,7 @@ pipe_write(struct kiocb *iocb, const struct iovec *_iov,
373 int error, atomic = 1; 374 int error, atomic = 1;
374 void *addr; 375 void *addr;
375 376
376 error = ops->pin(pipe, buf); 377 error = ops->confirm(pipe, buf);
377 if (error) 378 if (error)
378 goto out; 379 goto out;
379 380
diff --git a/fs/splice.c b/fs/splice.c
index d257d666358b..c804121601b0 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -85,8 +85,8 @@ static void page_cache_pipe_buf_release(struct pipe_inode_info *pipe,
85 buf->flags &= ~PIPE_BUF_FLAG_LRU; 85 buf->flags &= ~PIPE_BUF_FLAG_LRU;
86} 86}
87 87
88static int page_cache_pipe_buf_pin(struct pipe_inode_info *pipe, 88static int page_cache_pipe_buf_confirm(struct pipe_inode_info *pipe,
89 struct pipe_buffer *buf) 89 struct pipe_buffer *buf)
90{ 90{
91 struct page *page = buf->page; 91 struct page *page = buf->page;
92 int err; 92 int err;
@@ -127,7 +127,7 @@ static const struct pipe_buf_operations page_cache_pipe_buf_ops = {
127 .can_merge = 0, 127 .can_merge = 0,
128 .map = generic_pipe_buf_map, 128 .map = generic_pipe_buf_map,
129 .unmap = generic_pipe_buf_unmap, 129 .unmap = generic_pipe_buf_unmap,
130 .pin = page_cache_pipe_buf_pin, 130 .confirm = page_cache_pipe_buf_confirm,
131 .release = page_cache_pipe_buf_release, 131 .release = page_cache_pipe_buf_release,
132 .steal = page_cache_pipe_buf_steal, 132 .steal = page_cache_pipe_buf_steal,
133 .get = generic_pipe_buf_get, 133 .get = generic_pipe_buf_get,
@@ -147,7 +147,7 @@ static const struct pipe_buf_operations user_page_pipe_buf_ops = {
147 .can_merge = 0, 147 .can_merge = 0,
148 .map = generic_pipe_buf_map, 148 .map = generic_pipe_buf_map,
149 .unmap = generic_pipe_buf_unmap, 149 .unmap = generic_pipe_buf_unmap,
150 .pin = generic_pipe_buf_pin, 150 .confirm = generic_pipe_buf_confirm,
151 .release = page_cache_pipe_buf_release, 151 .release = page_cache_pipe_buf_release,
152 .steal = user_page_pipe_buf_steal, 152 .steal = user_page_pipe_buf_steal,
153 .get = generic_pipe_buf_get, 153 .get = generic_pipe_buf_get,
@@ -525,7 +525,7 @@ static int pipe_to_sendpage(struct pipe_inode_info *pipe,
525 loff_t pos = sd->pos; 525 loff_t pos = sd->pos;
526 int ret, more; 526 int ret, more;
527 527
528 ret = buf->ops->pin(pipe, buf); 528 ret = buf->ops->confirm(pipe, buf);
529 if (!ret) { 529 if (!ret) {
530 more = (sd->flags & SPLICE_F_MORE) || sd->len < sd->total_len; 530 more = (sd->flags & SPLICE_F_MORE) || sd->len < sd->total_len;
531 531
@@ -569,7 +569,7 @@ static int pipe_to_file(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
569 /* 569 /*
570 * make sure the data in this buffer is uptodate 570 * make sure the data in this buffer is uptodate
571 */ 571 */
572 ret = buf->ops->pin(pipe, buf); 572 ret = buf->ops->confirm(pipe, buf);
573 if (unlikely(ret)) 573 if (unlikely(ret))
574 return ret; 574 return ret;
575 575
@@ -1341,7 +1341,7 @@ static int pipe_to_user(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
1341 char *src; 1341 char *src;
1342 int ret; 1342 int ret;
1343 1343
1344 ret = buf->ops->pin(pipe, buf); 1344 ret = buf->ops->confirm(pipe, buf);
1345 if (unlikely(ret)) 1345 if (unlikely(ret))
1346 return ret; 1346 return ret;
1347 1347
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index 4409167b9eb2..cc09fe89bf07 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -35,20 +35,21 @@ struct pipe_inode_info {
35/* 35/*
36 * Note on the nesting of these functions: 36 * Note on the nesting of these functions:
37 * 37 *
38 * ->pin() 38 * ->confirm()
39 * ->steal() 39 * ->steal()
40 * ... 40 * ...
41 * ->map() 41 * ->map()
42 * ... 42 * ...
43 * ->unmap() 43 * ->unmap()
44 * 44 *
45 * That is, ->map() must be called on a pinned buffer, same goes for ->steal(). 45 * That is, ->map() must be called on a confirmed buffer,
46 * same goes for ->steal().
46 */ 47 */
47struct pipe_buf_operations { 48struct pipe_buf_operations {
48 int can_merge; 49 int can_merge;
49 void * (*map)(struct pipe_inode_info *, struct pipe_buffer *, int); 50 void * (*map)(struct pipe_inode_info *, struct pipe_buffer *, int);
50 void (*unmap)(struct pipe_inode_info *, struct pipe_buffer *, void *); 51 void (*unmap)(struct pipe_inode_info *, struct pipe_buffer *, void *);
51 int (*pin)(struct pipe_inode_info *, struct pipe_buffer *); 52 int (*confirm)(struct pipe_inode_info *, struct pipe_buffer *);
52 void (*release)(struct pipe_inode_info *, struct pipe_buffer *); 53 void (*release)(struct pipe_inode_info *, struct pipe_buffer *);
53 int (*steal)(struct pipe_inode_info *, struct pipe_buffer *); 54 int (*steal)(struct pipe_inode_info *, struct pipe_buffer *);
54 void (*get)(struct pipe_inode_info *, struct pipe_buffer *); 55 void (*get)(struct pipe_inode_info *, struct pipe_buffer *);
@@ -69,7 +70,7 @@ void __free_pipe_info(struct pipe_inode_info *);
69void *generic_pipe_buf_map(struct pipe_inode_info *, struct pipe_buffer *, int); 70void *generic_pipe_buf_map(struct pipe_inode_info *, struct pipe_buffer *, int);
70void generic_pipe_buf_unmap(struct pipe_inode_info *, struct pipe_buffer *, void *); 71void generic_pipe_buf_unmap(struct pipe_inode_info *, struct pipe_buffer *, void *);
71void generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *); 72void generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *);
72int generic_pipe_buf_pin(struct pipe_inode_info *, struct pipe_buffer *); 73int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *);
73int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *); 74int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *);
74 75
75#endif 76#endif
diff --git a/kernel/relay.c b/kernel/relay.c
index dd3bc5b69035..3b299fb3855c 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -1055,7 +1055,7 @@ static struct pipe_buf_operations relay_pipe_buf_ops = {
1055 .can_merge = 0, 1055 .can_merge = 0,
1056 .map = generic_pipe_buf_map, 1056 .map = generic_pipe_buf_map,
1057 .unmap = generic_pipe_buf_unmap, 1057 .unmap = generic_pipe_buf_unmap,
1058 .pin = generic_pipe_buf_pin, 1058 .confirm = generic_pipe_buf_confirm,
1059 .release = relay_pipe_buf_release, 1059 .release = relay_pipe_buf_release,
1060 .steal = generic_pipe_buf_steal, 1060 .steal = generic_pipe_buf_steal,
1061 .get = generic_pipe_buf_get, 1061 .get = generic_pipe_buf_get,