From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: [PATCH] trace-cmd library: Use uncompressed size for file size
Date: Wed, 8 Jun 2022 10:52:43 -0400 [thread overview]
Message-ID: <20220608105243.7eef6394@gandalf.local.home> (raw)
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
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.
Fixes: add83e0c8b511 ("trace-cmd library: Fix tracecmd_read_at()")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
lib/trace-cmd/trace-input.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index fea991ce732c..11c0057589b6 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;
}
--
2.35.1
reply other threads:[~2022-06-08 15:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220608105243.7eef6394@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).