From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.4 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA782C4363A for ; Mon, 26 Oct 2020 17:47:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 964CA2225C for ; Mon, 26 Oct 2020 17:47:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1788363AbgJZRrM (ORCPT ); Mon, 26 Oct 2020 13:47:12 -0400 Received: from mga12.intel.com ([192.55.52.136]:18462 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1788355AbgJZRrM (ORCPT ); Mon, 26 Oct 2020 13:47:12 -0400 IronPort-SDR: PjpLfO3tHYZxVRkyP/LJfPVpL0HExFEeduV7pUo9DOPm8YW0tGyZkw+li9nAxITo01SS7NymE7 CAvsW+6JVErQ== X-IronPort-AV: E=McAfee;i="6000,8403,9786"; a="147247828" X-IronPort-AV: E=Sophos;i="5.77,420,1596524400"; d="scan'208";a="147247828" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2020 10:47:11 -0700 IronPort-SDR: 87IvYXJf/B2GGXjaPxtnWGtPa1UQjFKLKyR4oNmhVg27NzktJpDbJHodHbu/DIxUaOJGwLdxDI MtfgvkZdmtUw== X-IronPort-AV: E=Sophos;i="5.77,420,1596524400"; d="scan'208";a="535449111" Received: from abudanko-mobl.ccr.corp.intel.com (HELO [10.249.226.224]) ([10.249.226.224]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2020 10:47:08 -0700 Subject: Re: [PATCH v2 03/15] perf data: open data directory in read access mode To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Adrian Hunter , Andi Kleen , Peter Zijlstra , Ingo Molnar , linux-kernel References: <1ec29ed6-0047-d22f-630b-a7f5ccee96b4@linux.intel.com> <20201024154317.GB2589351@krava> From: Alexey Budankov Organization: Intel Corp. Message-ID: Date: Mon, 26 Oct 2020 20:47:06 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201024154317.GB2589351@krava> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24.10.2020 18:43, Jiri Olsa wrote: > On Wed, Oct 21, 2020 at 06:57:53PM +0300, Alexey Budankov wrote: >> >> Open files located at trace data directory in case read access >> mode is requested. File are opened and its fds assigned to >> perf_data dir files especially for loading data directories >> content in perf report mode. >> >> Signed-off-by: Alexey Budankov >> --- >> tools/perf/util/data.c | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c >> index c47aa34fdc0a..6ad61ac6ba67 100644 >> --- a/tools/perf/util/data.c >> +++ b/tools/perf/util/data.c >> @@ -321,6 +321,10 @@ static int open_dir(struct perf_data *data) >> return -1; >> >> ret = open_file(data); >> + if (!ret && perf_data__is_dir(data)) { >> + if (perf_data__is_read(data)) >> + ret = perf_data__open_dir(data); >> + } > > perf_data__open_dir is also called from perf_session__new > is it called twice? It is not called twice. It is in different branches. This one is for write and the other one is for read. Alexei > > jirka > >> >> /* Cleanup whatever we managed to create so far. */ >> if (ret && perf_data__is_write(data)) >> -- >> 2.24.1 >> >