Skip to contentSkip to conversation

tracing: update file->f_pos when splice(2) it

PATCH In review Lai Jiangshan 1 participant 2 messages Apr 2, 2009 – Apr 10, 2009 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 3/4 tracing: update file->f_pos when splice(2) it

Impact: Cleanup

These two lines:

	if (unlikely(*ppos))
		return -ESPIPE;

in tracing_buffers_splice_read() are not needed, VFS layer has disabled seek(2).
We remove these two lines, and then we can update file->f_pos.

And tracing_buffers_read() updates file->f_pos, this fix make tracing_buffers_splice_read() updates file->f_pos too.

---

kernel/trace/trace.c +1 -7
index 2a81dec..d101c12 100644
@@ -3408,13 +3408,6 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
 	int size, i;
 	size_t ret;
 
-	/*
-	 * We can't seek on a buffer input
-	 */
-	if (unlikely(*ppos))
-		return -ESPIPE;
-
-
 	for (i = 0; i < PIPE_BUFFERS && len; i++, len -= size) {
 		struct page *page;
 		int r;
@@ -3454,6 +3447,7 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
 		spd.partial[i].offset = 0;
 		spd.partial[i].private = (unsigned long)ref;
 		spd.nr_pages++;
+		*ppos += size;
 	}
 
 	spd.nr_pages = i;
#1 lore raw
Commit-ID:  c7625a555f55d7ae49236cde551786c88f5a5ce1
Gitweb:     http://git.kernel.org/tip/c7625a555f55d7ae49236cde551786c88f5a5ce1
Author:     Lai Jiangshan <[email protected]>
AuthorDate: Thu, 2 Apr 2009 15:17:04 +0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 10 Apr 2009 12:44:44 +0200

tracing: update file->f_pos when splice(2) it

Impact: Cleanup

These two lines:

	if (unlikely(*ppos))
		return -ESPIPE;

in tracing_buffers_splice_read() are not needed, VFS layer has disabled seek(2).

We remove these two lines, and then we can update file->f_pos.

And tracing_buffers_read() updates file->f_pos, this fix make tracing_buffers_splice_read() updates file->f_pos too.

Cc Frederic Weisbecker <[email protected]>
Cc Steven Rostedt <[email protected]>

LKML-Reference: <[email protected]>

---
 kernel/trace/trace.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)
kernel/trace/trace.c +1 -7
index 8e189ff..9462976 100644
@@ -3428,13 +3428,6 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
 	int size, i;
 	size_t ret;
 
-	/*
-	 * We can't seek on a buffer input
-	 */
-	if (unlikely(*ppos))
-		return -ESPIPE;
-
-
 	for (i = 0; i < PIPE_BUFFERS && len; i++, len -= size) {
 		struct page *page;
 		int r;
@@ -3474,6 +3467,7 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
 		spd.partial[i].offset = 0;
 		spd.partial[i].private = (unsigned long)ref;
 		spd.nr_pages++;
+		*ppos += size;
 	}
 
 	spd.nr_pages = i;