perf tools: Fix dso__data_read_offset() file opening
authorNamhyung Kim <namhyung@kernel.org>
Wed, 20 May 2015 16:03:39 +0000 (01:03 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 27 May 2015 15:21:44 +0000 (12:21 -0300)
commit71ff824a60a7b0d9d0746e6e237fe4735077e5b4
tree573fd8686995d141c6f62105264cbce8c848de3a
parent8e160b2e1e3efdd84ddef726f9b5136dd192a682
perf tools: Fix dso__data_read_offset() file opening

When dso__data_read_offset/addr() is called without prior dso__data_fd()
(or other functions which call it internally), it failed to open dso in
data_file_size() since its binary type was not identified.

However calling dso__data_fd() in dso__data_read_offset() will hurt
performance as it grabs a global lock everytime.  So factor out the loop
on the binary type in dso__data_fd(), and call it from both.

Reported-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1432137821-10853-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/dso.c