aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (Google) <rostedt@goodmis.org>2022-06-08 10:52:43 -0400
committerSteven Rostedt (Google) <rostedt@goodmis.org>2022-06-08 12:59:41 -0400
commit719a0a72c3ee1ac3ca5eeb0ac697f371a9881ba0 (patch)
tree7b810e1f71dbe00eff567eea56ada1aae455d743
parent2e794e4f8d5ede7f83391cd80b1e9843d4f62c5c (diff)
downloadtrace-cmd-719a0a72c3ee1ac3ca5eeb0ac697f371a9881ba0.tar.gz
trace-cmd library: Use uncompressed size for file size
For tracecmd_read_at() to work, each offset for every record in the file needs to be unique. To do so, each CPU's file_offset is from the last CPU's file_offset plus its size. But the size used was the compressed size and not the uncompressed size. This had "interesting" effects, where some lookups were failing. It also caused tracecmd_read_cpu_last() to not return the last event. Link: https://lore.kernel.org/linux-trace-devel/20220608105243.7eef6394@gandalf.local.home Fixes: add83e0c8b511 ("trace-cmd library: Fix tracecmd_read_at()") Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-rw-r--r--lib/trace-cmd/trace-input.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index fea991ce..11c00575 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -2699,13 +2699,14 @@ static int init_cpu_zpage(struct tracecmd_input *handle, int cpu)
cpu_data->compress.last_chunk = 0;
cpu_data->file_offset = handle->next_offset;
+ cpu_data->file_size = 0;
for (i = 0; i < count; i++)
cpu_data->file_size += cpu_data->compress.chunks[i].size;
cpu_data->offset = cpu_data->file_offset;
cpu_data->size = cpu_data->file_size;
- handle->next_offset = (handle->next_offset + cpu_data->size + handle->page_size - 1) &
+ handle->next_offset = (handle->next_offset + cpu_data->file_size + handle->page_size - 1) &
~(handle->page_size - 1);
return 0;
}