[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>
This commit is contained in:
@@ -354,6 +354,7 @@ static int pipe_to_sendpage(struct pipe_inode_info *info,
|
|||||||
unsigned int offset;
|
unsigned int offset;
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
int more;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* sub-optimal, but we are limited by the pipe ->map. we don't
|
* 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,
|
|||||||
return PTR_ERR(ptr);
|
return PTR_ERR(ptr);
|
||||||
|
|
||||||
offset = pos & ~PAGE_CACHE_MASK;
|
offset = pos & ~PAGE_CACHE_MASK;
|
||||||
|
more = (sd->flags & SPLICE_F_MORE) || sd->len < sd->total_len;
|
||||||
|
|
||||||
ret = file->f_op->sendpage(file, buf->page, offset, sd->len, &pos,
|
ret = file->f_op->sendpage(file, buf->page, offset, sd->len, &pos,more);
|
||||||
sd->len < sd->total_len);
|
|
||||||
|
|
||||||
buf->ops->unmap(info, buf);
|
buf->ops->unmap(info, buf);
|
||||||
if (ret == sd->len)
|
if (ret == sd->len)
|
||||||
|
@@ -62,5 +62,6 @@ void free_pipe_info(struct inode* inode);
|
|||||||
#define SPLICE_F_NONBLOCK (0x02) /* don't block on the pipe splicing (but */
|
#define SPLICE_F_NONBLOCK (0x02) /* don't block on the pipe splicing (but */
|
||||||
/* we may still block on the fd we splice */
|
/* we may still block on the fd we splice */
|
||||||
/* from/to, of course */
|
/* from/to, of course */
|
||||||
|
#define SPLICE_F_MORE (0x04) /* expect more data */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user