Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3323651yba; Tue, 16 Apr 2019 09:04:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqzO37qmyoejIpJkLoD3xrn05OO4SsDbALeAM9KciQEvV9C8HI3DsWD5JFZZBD/h5HFHsH1Y X-Received: by 2002:a17:902:2a4b:: with SMTP id i69mr27506885plb.292.1555430648493; Tue, 16 Apr 2019 09:04:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555430648; cv=none; d=google.com; s=arc-20160816; b=RZXKUhvQ5OVIKqTpR4NH3qwhPubv1jpmdBGIxSUL9gHknSnFdu1fedKspcRvWZNFfP fjeHu2L8TKWpZPB6LWqtOHe2Rc3ygJQeBS7S58mG4oPvySQLXVk/So0tcD0Xv5yuqPDd MFerT5JGPs1X0C9lPUROCpF8z5yAgyBibFOWetzayy/tLrVj4NrIGKg5R+ESdURaxJg+ WdQiNnDlFZhKZg+b51LsuSjfCckCTvVoLvgO59zyMvJQwMRwpInn36H+Vl58HDZfuOmI +Y0CMCNgD0F2gV3QPh6LOtupTdMM7+h4zC2y1wBO8Ry9i1bzj/seF+aBhnnEuK8/RoOo R4zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=91lsDd9vnEmqj6ISq5V8lhr2YNIZx8XZ9ctHJyHb5p8=; b=u+LoELxmpNmxYO1e1djDfAzfTk/1barOUkGIhGbFNFjN+lPLl3VfKBgIEFW8gI+uMI Sb9igrH9drtzPl5HeMnGkMenfn8KhZrHldfGRrC7M3oX2Cl7xa6csMgI9QfmH5Bbi7V6 0/zmVia7741Nk0H0WsyUMpYcpbPwskrsbrrIDAxqLv0cP2piDGZYcFD/gSvhcoEppOx7 bchx1HvPL+CbbmsOfoX+o464TlVGuhp7YPIl8jHLskaBWmVKEmfoP0ckLP93Uz+03UFO 2MbZ4QBqlv9uuI0rDtMk9xMRHgX6zGPpYCUVycr2hK199xuq18RAPlq7gtfHV2jNspDk Pe1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p8si47917471plq.225.2019.04.16.09.03.52; Tue, 16 Apr 2019 09:04:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729872AbfDPQBl (ORCPT + 99 others); Tue, 16 Apr 2019 12:01:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43846 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727691AbfDPQBj (ORCPT ); Tue, 16 Apr 2019 12:01:39 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 76F9B3092676; Tue, 16 Apr 2019 16:01:39 +0000 (UTC) Received: from krava.brq.redhat.com (unknown [10.43.17.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A9DA5D71B; Tue, 16 Apr 2019 16:01:36 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Andi Kleen , Adrian Hunter , Song Liu , Alexei Starovoitov , Daniel Borkmann Subject: [PATCH 01/12] perf tools: Separate generic code in dso__data_file_size Date: Tue, 16 Apr 2019 18:01:16 +0200 Message-Id: <20190416160127.30203-2-jolsa@kernel.org> In-Reply-To: <20190416160127.30203-1-jolsa@kernel.org> References: <20190416160127.30203-1-jolsa@kernel.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 16 Apr 2019 16:01:39 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Moving file specific code in dso__data_file_size function into separate file_size function. I'll add bpf specific code in following patches. Link: http://lkml.kernel.org/n/tip-rkcsft4a0f8sw33p67llxf0d@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/util/dso.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index e059976d9d93..cb6199c1390a 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c @@ -898,18 +898,12 @@ static ssize_t cached_read(struct dso *dso, struct machine *machine, return r; } -int dso__data_file_size(struct dso *dso, struct machine *machine) +static int file_size(struct dso *dso, struct machine *machine) { int ret = 0; struct stat st; char sbuf[STRERR_BUFSIZE]; - if (dso->data.file_size) - return 0; - - if (dso->data.status == DSO_DATA_STATUS_ERROR) - return -1; - pthread_mutex_lock(&dso__data_open_lock); /* @@ -938,6 +932,17 @@ int dso__data_file_size(struct dso *dso, struct machine *machine) return ret; } +int dso__data_file_size(struct dso *dso, struct machine *machine) +{ + if (dso->data.file_size) + return 0; + + if (dso->data.status == DSO_DATA_STATUS_ERROR) + return -1; + + return file_size(dso, machine); +} + /** * dso__data_size - Return dso data size * @dso: dso object -- 2.17.2