aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (Google) <rostedt@goodmis.org>2024-01-11 17:12:07 -0500
committerSteven Rostedt (Google) <rostedt@goodmis.org>2024-01-11 17:50:06 -0500
commit1571b67c3ca2e1b6ad5f38559a4c224f710ca4fe (patch)
tree464e3f603994e90ee1b67779a3db274a688ead6a
parent691cfddb79d8cdbc266fdf58e1851fcc7f14c4cc (diff)
downloadtrace-cmd-1571b67c3ca2e1b6ad5f38559a4c224f710ca4fe.tar.gz
libtracecmd: Fix free_zpage() offset
The offset exposed to the callers of libtracecmd is the uncompressed file offset. The read_zpage() subtracts the fake uncompressed offset to get to the compressed data offset. The free_zpage() did not subtract the uncompressed offset so it was not finding the cached compressed data it was looking for to free, and left the page not freed. Subtract the uncompressed file offset from the passed in offset to find the cached node to free. Link: https://lore.kernel.org/linux-trace-devel/20240111171207.54d7cdbf@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.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index 88bef83f..e0194f89 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -1384,6 +1384,8 @@ static void free_zpage(struct cpu_data *cpu_data, off_t offset)
struct trace_rbtree_node *node;
struct zchunk_cache *cache;
+ offset -= cpu_data->file_offset;
+
node = trace_rbtree_find(&cpu_data->compress.cache, (void *)&offset);
if (!node)