From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938635AbcISNKb (ORCPT ); Mon, 19 Sep 2016 09:10:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44242 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936419AbcISNKQ (ORCPT ); Mon, 19 Sep 2016 09:10:16 -0400 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Don Zickus , Joe Mario , Ingo Molnar , Peter Zijlstra , Namhyung Kim , David Ahern , Andi Kleen Subject: [PATCH 01/61] perf symbols: Do not open device files again Date: Mon, 19 Sep 2016 15:09:10 +0200 Message-Id: <1474290610-23241-2-git-send-email-jolsa@kernel.org> In-Reply-To: <1474290610-23241-1-git-send-email-jolsa@kernel.org> References: <1474290610-23241-1-git-send-email-jolsa@kernel.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 19 Sep 2016 13:10:16 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Moving the regular file check into the entry of the dso__read_binary_type_filename function. This way we can eliminate some calls and extend the file check for all cases. Link: http://lkml.kernel.org/n/tip-np802m7jwzd7fu09vx2tp23y@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/util/dso.c | 8 +++----- tools/perf/util/symbol.c | 3 --- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index 774f6ec884d5..9a027a0cc037 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c @@ -43,6 +43,9 @@ int dso__read_binary_type_filename(const struct dso *dso, int ret = 0; size_t len; + if (!is_regular_file(filename)) + return -1; + switch (type) { case DSO_BINARY_TYPE__DEBUGLINK: { char *debuglink; @@ -53,11 +56,6 @@ int dso__read_binary_type_filename(const struct dso *dso, debuglink--; if (*debuglink == '/') debuglink++; - - ret = -1; - if (!is_regular_file(filename)) - break; - ret = filename__read_debuglink(filename, debuglink, size - (debuglink - filename)); } diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 19c9c558454f..827a58ce29f0 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -1466,9 +1466,6 @@ int dso__load(struct dso *dso, struct map *map) root_dir, name, PATH_MAX)) continue; - if (!is_regular_file(name)) - continue; - /* Name is now the name of the next image to try */ if (symsrc__init(ss, dso, name, symtab_type) < 0) continue; -- 2.7.4