aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <axboe@suse.de>2006-04-02 17:05:41 -0400
committerJens Axboe <axboe@suse.de>2006-04-02 17:05:41 -0400
commitb2b39fa478db6db89b7ccafb0649973845b0eb75 (patch)
tree784d85b94fb634e3b33dfd3f1153c98580cfac15
parent83f9135bddffded9f1716519b6c147bcf046c87e (diff)
[PATCH] splice: add a SPLICE_F_MORE flag
This lets userspace indicate whether more data will be coming in a subsequent splice call. Signed-off-by: Jens Axboe <axboe@suse.de>
-rw-r--r--fs/splice.c5
-rw-r--r--include/linux/pipe_fs_i.h1
2 files changed, 4 insertions, 2 deletions
diff --git a/fs/splice.c b/fs/splice.c
index 34591924c783..e84544558946 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -354,6 +354,7 @@ static int pipe_to_sendpage(struct pipe_inode_info *info,
354 unsigned int offset; 354 unsigned int offset;
355 ssize_t ret; 355 ssize_t ret;
356 void *ptr; 356 void *ptr;
357 int more;
357 358
358 /* 359 /*
359 * sub-optimal, but we are limited by the pipe ->map. we don't 360 * sub-optimal, but we are limited by the pipe ->map. we don't
@@ -366,9 +367,9 @@ static int pipe_to_sendpage(struct pipe_inode_info *info,
366 return PTR_ERR(ptr); 367 return PTR_ERR(ptr);
367 368
368 offset = pos & ~PAGE_CACHE_MASK; 369 offset = pos & ~PAGE_CACHE_MASK;
370 more = (sd->flags & SPLICE_F_MORE) || sd->len < sd->total_len;
369 371
370 ret = file->f_op->sendpage(file, buf->page, offset, sd->len, &pos, 372 ret = file->f_op->sendpage(file, buf->page, offset, sd->len, &pos,more);
371 sd->len < sd->total_len);
372 373
373 buf->ops->unmap(info, buf); 374 buf->ops->unmap(info, buf);
374 if (ret == sd->len) 375 if (ret == sd->len)
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index 32865004751c..70ae9332ec16 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -62,5 +62,6 @@ void free_pipe_info(struct inode* inode);
62#define SPLICE_F_NONBLOCK (0x02) /* don't block on the pipe splicing (but */ 62#define SPLICE_F_NONBLOCK (0x02) /* don't block on the pipe splicing (but */
63 /* we may still block on the fd we splice */ 63 /* we may still block on the fd we splice */
64 /* from/to, of course */ 64 /* from/to, of course */
65#define SPLICE_F_MORE (0x04) /* expect more data */
65 66
66#endif 67#endif