Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp128267pxm; Tue, 22 Feb 2022 18:38:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJwPyDqbLNXwL3fSPfVqcVqhdCMcvIRfbCQaXtzon7eQXBJHMQuOX6vH0CkfRmql0BbZVIvv X-Received: by 2002:a05:6a00:21c7:b0:4e1:dba1:a3a6 with SMTP id t7-20020a056a0021c700b004e1dba1a3a6mr25705564pfj.59.1645583929073; Tue, 22 Feb 2022 18:38:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645583929; cv=none; d=google.com; s=arc-20160816; b=X0FRRjd5TQ85sWTPHSV79HMuDEZRB6IjAMxxJRjUPpCdvspGAsxq6G91uZbttYxNYV QBV3I+jLZmzmZ7SXILdEhAlv7FbdAPOtknzXiAAt0b9S9ewazX/1hkiaZnFOVb4Y63j5 7EDSv/CLLiIs0Iw70GskZrj9uamPLICAeYBpYcM+n3fOaOV8piOZJk3w1pgG8NDO+Z/F +KjkJk+nBeoTyj8l8Lp9k6FGWV7HaUcUsCeq2ZrQcLHUxgMT2K611QQgEUfpOB/wukXK Rwe5RiD3ZGdv8ZUgylfi4srnrKJEcs8JlffrtiJhZuApgStwZLnm5gwTcBUBvDgD7CCn sfXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mKjcU1kcdAY0U8EQKCLV1xodPjdGstANx80RpuoVnz0=; b=HPTQaD5Yq4qe/vZ1xGWVqy8Nq/pRlTNyUZT6Gx/aUoIacQe8cxBBXV3+w0sK/oyfZ7 1MbgnE85KuktmTEJMG32eCrbRBlmvtWBW/l1gG2tHW/+M2wPJAS70wa3RZ/Oz7UCPToO 0czRdsPsR53cfXS+VJjR+H5CrT1t9dbBHNIU2lxojLuzptSDq10h4kbVEk8pmxBiayUY DLOo5q74QUk3LHWxydKxnko98lvm9jkgzXGa8eg246/FklO/1xUkvv4KcQyTorb11f/9 SGaRf4wrVoR09pEeeQ2Uo7VAT8uwpc8pvrZ6NT5vyPM6EB22Rrw30GzDJwQcoVp45TAr JYjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Gx5LL5tQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b7-20020a17090aa58700b001b8a42457acsi1061222pjq.63.2022.02.22.18.38.32; Tue, 22 Feb 2022 18:38:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Gx5LL5tQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231596AbiBWART (ORCPT + 99 others); Tue, 22 Feb 2022 19:17:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229544AbiBWARS (ORCPT ); Tue, 22 Feb 2022 19:17:18 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 498BA4C42F for ; Tue, 22 Feb 2022 16:16:51 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D879761295 for ; Wed, 23 Feb 2022 00:16:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24416C340E8; Wed, 23 Feb 2022 00:16:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645575410; bh=IfJ0A6W4odMqfWAuTFyGgLeQeK9RTCZE2nzukCzpgwo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Gx5LL5tQelWrgwB2WtG/RWMgFJ6juCb2GtefL38y00ZaDrqkxQGO0NWPfYb/EpuRD t1BukWyurJtUPd8fppnYYwnARQW0FJwcX/IYgeKnYLKBYTOJY3Ky5vtg6F7JWF2pza AJu6wpXJKauUAdZWDlmCsR+2fHBbdJ9ouRjar68VHASBhWy6hhDXbuArX5do0zwumf xyEXcARS0giq18hKfJdJJYlvGWFd+4uEtI0Yein5AM/G/ORn7aOE/Iw5syyFt62L0C bmcFwl1RkK5brtLC1MjZwq81Y7ySNDpoZMH5iprAs2qX+/D7PGgAu2xSd0RKyEFHr7 LPF1l76LZyZbQ== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 932AB400FE; Tue, 22 Feb 2022 21:16:47 -0300 (-03) Date: Tue, 22 Feb 2022 21:16:47 -0300 From: Arnaldo Carvalho de Melo To: Jiri Olsa Cc: Alexey Bayduraev , Jiri Olsa , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , linux-kernel , Adrian Hunter , Alexander Antonov , Alexei Budankov Subject: Re: [PATCH core v2] perf data: Adding error message if perf_data__create_dir fails Message-ID: References: <20220222091417.11020-1-alexey.v.bayduraev@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, Feb 22, 2022 at 11:06:02PM +0100, Jiri Olsa escreveu: > On Tue, Feb 22, 2022 at 12:14:17PM +0300, Alexey Bayduraev wrote: > > Adding proper return codes for all cases of data directory creation > > failure and adding error message output based on these codes. > > > > Signed-off-by: Alexey Bayduraev > > Acked-by: Jiri Olsa Thanks, applied. - Arnaldo > thanks, > jirka > > > --- > > tools/perf/builtin-record.c | 4 +++- > > tools/perf/util/data.c | 8 ++++++-- > > 2 files changed, 9 insertions(+), 3 deletions(-) > > > > diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c > > index 0bc6529814b2..0b4abed555d8 100644 > > --- a/tools/perf/builtin-record.c > > +++ b/tools/perf/builtin-record.c > > @@ -1186,8 +1186,10 @@ static int record__mmap_evlist(struct record *rec, > > > > if (record__threads_enabled(rec)) { > > ret = perf_data__create_dir(&rec->data, evlist->core.nr_mmaps); > > - if (ret) > > + if (ret) { > > + pr_err("Failed to create data directory: %s\n", strerror(-ret)); > > return ret; > > + } > > for (i = 0; i < evlist->core.nr_mmaps; i++) { > > if (evlist->mmap) > > evlist->mmap[i].file = &rec->data.dir.files[i]; > > diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c > > index f5d260b1df4d..dc5d82ea1c30 100644 > > --- a/tools/perf/util/data.c > > +++ b/tools/perf/util/data.c > > @@ -52,12 +52,16 @@ int perf_data__create_dir(struct perf_data *data, int nr) > > struct perf_data_file *file = &files[i]; > > > > ret = asprintf(&file->path, "%s/data.%d", data->path, i); > > - if (ret < 0) > > + if (ret < 0) { > > + ret = -ENOMEM; > > goto out_err; > > + } > > > > ret = open(file->path, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR); > > - if (ret < 0) > > + if (ret < 0) { > > + ret = -errno; > > goto out_err; > > + } > > > > file->fd = ret; > > } > > -- > > 2.19.0 > > -- - Arnaldo