Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5414869pxu; Thu, 22 Oct 2020 01:24:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzRoFpJ54Q02AG02fQP7mrmaCDDieO/pv9lbOn5639G/lhs3ExhuDxjpUMY5hQnOsYvb2C X-Received: by 2002:a17:906:c186:: with SMTP id g6mr1090014ejz.465.1603355061103; Thu, 22 Oct 2020 01:24:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603355061; cv=none; d=google.com; s=arc-20160816; b=OJROvyjtACAzejoNdd6P+mgYjb5FuBfS7UwWRZZPPpPI/4lQFzLnk7zxrZ+XIo5KZW 7esXhm7gsTokNBJ30OhJAIjcg/b7pVXlNzzP1OvGQX8TFne5SniBVZQ2NsVXrmIZjSS3 0/ZSBIpcjIyz7Xr7jGLzDbV9dxpCwJ1a4MrzSBya88gX8PGSvVScHZCOyFi4vVsR5Qtw F7sCXci86B/xk8gkyKg2TydnA8k1RkyMN8CpfukH6s9P9jVsMbH1Kr6auTnLbnK7v0kY 5cqdgzQRmrI7lluJRGefwrFabmlGsNMlvzQMUeZeCgYwvGgFiXNguOorf5BZiT3dg66Z 5B0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=MXNqjrdYx6upFpGxSfIxLtwcpQgyuN+kuEUfgmX07dM=; b=Sr1O594wyzxl9gh5Oorf9JP/T9BHltbL2Zk0aRuTRZMCbTO8LtcS5AeXKKjaESVjnM HXwLjzq4XBMLGsxVifRfjM4rNRcupJu8i9YAPEEbihammDGE4LJ99le/MV0IBYaqKOsF Iy02t1I+A5zDCMxF9GD598do2GuCutz+q/ZZe6WDZMmJafVhR3saLmOwvhxrYW5F2HKd s3WMM+14DxKuRydkw0DHKSmqlmvKCTS7D5/va1ZYooqadW8+UepdDDgT92jddc9pC95h GCLK9XpV8uWeb518TpHWDCL8eBPY9fTmtMFqyCjObPqEazaTnOV5SefnbXtguqZXJtL4 AcOA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g8si514312ejm.497.2020.10.22.01.23.59; Thu, 22 Oct 2020 01:24:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407888AbgJVEbP (ORCPT + 99 others); Thu, 22 Oct 2020 00:31:15 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:38695 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394994AbgJVEbP (ORCPT ); Thu, 22 Oct 2020 00:31:15 -0400 Received: by mail-wm1-f66.google.com with SMTP id l15so388250wmi.3 for ; Wed, 21 Oct 2020 21:31:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MXNqjrdYx6upFpGxSfIxLtwcpQgyuN+kuEUfgmX07dM=; b=DlfMSFzm80qTuDD5MyZzaGa2quLtvjafGleVRoOoLhKkPhfbEokAfe+XiP7UdYUSLc iXr4UtUF2+SCH0+pvgx2OkGpEuO79Lx/G+jaxG0MgQGHUFMSmC9OhDIPIpln2/axHkzO mjB+m3kOAaJJiqjZTcLvCi7Aq18yCfd0eZyAjjF/hGMxHmlWguoJmhGFB5aZL0BqmRWr rzjobRGs9RToAkry2BOJYtOWZVxLyYxhJzuAE59YU3vwBDAwlm7tKI0xh+VNiOCfOehG aPXJCqROuCO5/u5noE4JZXF5p5qDn14+kUsEO6Jt7Z99Y1UIFtosvrlaHuClEinCxf3w w45Q== X-Gm-Message-State: AOAM530GdL5jgjKFDQ13hdgX6d2qjG0X3w2t/OCbLQtCzJN2d+A9GooP xerz+EyPl53IW9otZGakW9MJcuHX2/0mRVvcKtg= X-Received: by 2002:a7b:c7c3:: with SMTP id z3mr574227wmk.43.1603341073283; Wed, 21 Oct 2020 21:31:13 -0700 (PDT) MIME-Version: 1.0 References: <1ec29ed6-0047-d22f-630b-a7f5ccee96b4@linux.intel.com> In-Reply-To: From: Namhyung Kim Date: Thu, 22 Oct 2020 13:31:02 +0900 Message-ID: Subject: Re: [PATCH v2 03/15] perf data: open data directory in read access mode To: Alexey Budankov Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Alexander Shishkin , Adrian Hunter , Andi Kleen , Peter Zijlstra , Ingo Molnar , linux-kernel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 22, 2020 at 12:58 AM 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)) { I think this __is_dir() check is unnecessary since it's checked from the caller side already. Thanks Namhyung > + if (perf_data__is_read(data)) > + ret = perf_data__open_dir(data); > + } > > /* Cleanup whatever we managed to create so far. */ > if (ret && perf_data__is_write(data)) > -- > 2.24.1 >