aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/relay.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/relay.c')
-rw-r--r--kernel/relay.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/kernel/relay.c b/kernel/relay.c
index d080b9d161a7..d6204a485818 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -736,7 +736,7 @@ static int relay_file_open(struct inode *inode, struct file *filp)
736 kref_get(&buf->kref); 736 kref_get(&buf->kref);
737 filp->private_data = buf; 737 filp->private_data = buf;
738 738
739 return 0; 739 return nonseekable_open(inode, filp);
740} 740}
741 741
742/** 742/**
@@ -1056,6 +1056,10 @@ static struct pipe_buf_operations relay_pipe_buf_ops = {
1056 .get = generic_pipe_buf_get, 1056 .get = generic_pipe_buf_get,
1057}; 1057};
1058 1058
1059static void relay_page_release(struct splice_pipe_desc *spd, unsigned int i)
1060{
1061}
1062
1059/* 1063/*
1060 * subbuf_splice_actor - splice up to one subbuf's worth of data 1064 * subbuf_splice_actor - splice up to one subbuf's worth of data
1061 */ 1065 */
@@ -1066,7 +1070,7 @@ static int subbuf_splice_actor(struct file *in,
1066 unsigned int flags, 1070 unsigned int flags,
1067 int *nonpad_ret) 1071 int *nonpad_ret)
1068{ 1072{
1069 unsigned int pidx, poff, total_len, subbuf_pages, ret; 1073 unsigned int pidx, poff, total_len, subbuf_pages, nr_pages, ret;
1070 struct rchan_buf *rbuf = in->private_data; 1074 struct rchan_buf *rbuf = in->private_data;
1071 unsigned int subbuf_size = rbuf->chan->subbuf_size; 1075 unsigned int subbuf_size = rbuf->chan->subbuf_size;
1072 uint64_t pos = (uint64_t) *ppos; 1076 uint64_t pos = (uint64_t) *ppos;
@@ -1083,6 +1087,7 @@ static int subbuf_splice_actor(struct file *in,
1083 .partial = partial, 1087 .partial = partial,
1084 .flags = flags, 1088 .flags = flags,
1085 .ops = &relay_pipe_buf_ops, 1089 .ops = &relay_pipe_buf_ops,
1090 .spd_release = relay_page_release,
1086 }; 1091 };
1087 1092
1088 if (rbuf->subbufs_produced == rbuf->subbufs_consumed) 1093 if (rbuf->subbufs_produced == rbuf->subbufs_consumed)
@@ -1097,8 +1102,9 @@ static int subbuf_splice_actor(struct file *in,
1097 subbuf_pages = rbuf->chan->alloc_size >> PAGE_SHIFT; 1102 subbuf_pages = rbuf->chan->alloc_size >> PAGE_SHIFT;
1098 pidx = (read_start / PAGE_SIZE) % subbuf_pages; 1103 pidx = (read_start / PAGE_SIZE) % subbuf_pages;
1099 poff = read_start & ~PAGE_MASK; 1104 poff = read_start & ~PAGE_MASK;
1105 nr_pages = min_t(unsigned int, subbuf_pages, PIPE_BUFFERS);
1100 1106
1101 for (total_len = 0; spd.nr_pages < subbuf_pages; spd.nr_pages++) { 1107 for (total_len = 0; spd.nr_pages < nr_pages; spd.nr_pages++) {
1102 unsigned int this_len, this_end, private; 1108 unsigned int this_len, this_end, private;
1103 unsigned int cur_pos = read_start + total_len; 1109 unsigned int cur_pos = read_start + total_len;
1104 1110