[PATCH] libtracecmd: Fix free_zpage() offset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>

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.

Fixes: add83e0c8b511 ("trace-cmd library: Fix tracecmd_read_at()")
Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
---
 lib/trace-cmd/trace-input.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index 88bef83f4fe0..e0194f89e5db 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)
-- 
2.43.0





[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux