Commit 4f5a473d authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

perf session: Get rid of file_size variable

It's not needed and removing it makes the code a little simpler for the
upcoming changes.

It's safe to replace file_size with data_size, because the
perf_data__size() value is never smaller than data_offset + data_size.
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20190110101301.6196-3-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 7ba4da10
......@@ -1825,7 +1825,6 @@ static int __perf_session__process_events(struct perf_session *session)
struct ordered_events *oe = &session->ordered_events;
struct perf_tool *tool = session->tool;
int fd = perf_data__fd(session->data);
u64 file_size = perf_data__size(session->data);
u64 data_offset = session->header.data_offset;
u64 data_size = session->header.data_size;
u64 head, page_offset, file_offset, file_pos, size;
......@@ -1845,14 +1844,13 @@ static int __perf_session__process_events(struct perf_session *session)
if (data_size == 0)
goto out;
if (data_offset + data_size < file_size)
file_size = data_offset + data_size;
ui_progress__init_size(&prog, data_size, "Processing events...");
ui_progress__init_size(&prog, file_size, "Processing events...");
data_size += data_offset;
mmap_size = MMAP_SIZE;
if (mmap_size > file_size) {
mmap_size = file_size;
if (mmap_size > data_size) {
mmap_size = data_size;
session->one_mmap = true;
}
......@@ -1917,7 +1915,7 @@ static int __perf_session__process_events(struct perf_session *session)
if (session_done())
goto out;
if (file_pos < file_size)
if (file_pos < data_size)
goto more;
out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment