All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] trace-cmd record: Use result of fcntl(GETPIPE_SZ)
@ 2022-09-28 13:57 Steven Rostedt
  0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2022-09-28 13:57 UTC (permalink / raw)
  To: Linux Trace Devel

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

For some reason, I thought the arg to fcntl(fd, F_GETPIPE_SZ, &arg) would
give the pipe size. But the argument is completely ignored (I remember
testing this, and it worked :-/)

The return of the function is the pipe size. Use that if pipe_size is
untouched (which it ought to be) as the pipe size.

Fixes: a64fab23cec2 ("trace-cmd recorder: Use full pipe size in splice_data()")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 lib/trace-cmd/trace-recorder.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/trace-cmd/trace-recorder.c b/lib/trace-cmd/trace-recorder.c
index c7ef13c851d2..25c26def3784 100644
--- a/lib/trace-cmd/trace-recorder.c
+++ b/lib/trace-cmd/trace-recorder.c
@@ -204,7 +204,9 @@ tracecmd_create_buffer_recorder_fd2(int fd, int fd2, int cpu, unsigned flags,
 		 * back to using page_size for splice(). It could also return
 		 * success, but not modify pipe_size.
 		 */
-		if (ret < 0 || !pipe_size)
+		if (ret > 0 && !pipe_size)
+			pipe_size = ret;
+		else if (ret < 0)
 			pipe_size = recorder->page_size;
 
 		recorder->pipe_size = pipe_size;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-28 13:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28 13:57 [PATCH] trace-cmd record: Use result of fcntl(GETPIPE_SZ) Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.