Message ID | 20230628150243.17771-1-andriy.shevchenko@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9002910vqr; Wed, 28 Jun 2023 08:15:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7G4gTsQhJgsyiy2HyfqGNVo+LeuPF3Iww4gzqJsiv0Sfld8XAfmzu5yjEqDmc6/9NoYM+w X-Received: by 2002:a05:6a00:1d18:b0:668:70af:b5c1 with SMTP id a24-20020a056a001d1800b0066870afb5c1mr121049pfx.1.1687965354964; Wed, 28 Jun 2023 08:15:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687965354; cv=none; d=google.com; s=arc-20160816; b=hcgUOkSssz5AZsrXsT/YFgOKF8jc+g2mluDotXMy0SqrYFfroyBe3vZ8GlNvN5TpnO 4qGP7XgTIaSbVdY9vIK+0YbhC1qeIoykyqm/xWE44vTfkr8cnAlzLlkCtWwsV7vpLVfk s0HSpkATq9C7+7yiobHiteH67+5Mo1CWmQ+6aeYiKyittW8Pz9PclNH2R7kzJtmuFlVX oBvD3SrmG8Kil2EutlMrR5Wu2iuZVbIWC+lapv+eH1ncrK6DmVYtXqAUHRuzkutoAr97 rdaFMEAXYQHcsknXoIYfKYAcHLgSuI14DSkziJd9T0CpxnwBkIHSJ6CiXKTZKhD50gGY YHIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=kblpPaMOMJ5krQu789DhNdxSi2f14Uxv7ol6nfeg8+g=; fh=yM4bEVF+hoT9lSLtIMAhXwTkxv4DZ8BDBzGwnRDCcoo=; b=yjPsd1bHsc8BKulYSbuQOufX8QGb7/I386Zrzfd4WinEcuAXB43gtBktBLqBIzReq5 dIpOl6KrtyuUXuOcgbZKDRcJ9hZCwIZhZmRrFFp4M0fp0GFBQE/tuxXS2v4w2HF/ZaZA 7EqcbKGWc86Mc1zyOT5z7rwkQ9dJsnsdetx/mo0KCw2Zi/WREgdOOsrWXe60FdEsChgZ vs3X1sy1O7zog96C+OdqSoVXfco9LVnubmoLPrMrBkq3klyb+dw7D+UiZkkX+rXp89qZ NNjA80BKTBbsSs/6IT/pB1U5uiopNSxrtPmvMFyQxe7qslpcYv7NviTBjfJ/XGUcSM06 WXqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NVudJMnQ; 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=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y22-20020a056a00181600b006689fb2e015si7982889pfa.308.2023.06.28.08.15.41; Wed, 28 Jun 2023 08:15:54 -0700 (PDT) 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=@intel.com header.s=Intel header.b=NVudJMnQ; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231953AbjF1PEH (ORCPT <rfc822;ivan.orlov0322@gmail.com> + 99 others); Wed, 28 Jun 2023 11:04:07 -0400 Received: from mga17.intel.com ([192.55.52.151]:32511 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231940AbjF1PEC (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 28 Jun 2023 11:04:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687964642; x=1719500642; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=1gfH1VI8rikXgJa4+jQmJEeCxlL86Kd/v1XPUYZdwvk=; b=NVudJMnQQpNBXm1om++DAR4sS4WMQ8gE4efb/0CLFQM76Pk2ZJPOZyUd gV05B/sGO606TeinZmruLvg+WHeBDKLQViRo9sjbX13+nw+EeuZ05+j1R vjq2kcTNJZu7vjaG1KRAYXet2Zr+TzWSJl5MaK5VHEUCG1uMhD2mxdbxA Rh82Rb9qOzcTns15KY8rcORNds/gjR9djm5swbbi2z46iy9FlfmhVngR6 vak63fITaSc9775wpcarZyNKJ2f5eogqgfQk9W4cDeYHS2aE8xlMqaN5m ZanDOCcgK+PJ7OaXIY0a5oR6SuY7wafDLNvEKhGbMmoWe5rdz2A9TmSwj A==; X-IronPort-AV: E=McAfee;i="6600,9927,10755"; a="342206006" X-IronPort-AV: E=Sophos;i="6.01,165,1684825200"; d="scan'208";a="342206006" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2023 08:02:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10755"; a="667159873" X-IronPort-AV: E=Sophos;i="6.01,165,1684825200"; d="scan'208";a="667159873" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 28 Jun 2023 08:02:46 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 63569E1; Wed, 28 Jun 2023 18:02:47 +0300 (EEST) From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <chao@kernel.org>, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: Steven Rostedt <rostedt@goodmis.org>, Masami Hiramatsu <mhiramat@kernel.org>, Andy Shevchenko <andriy.shevchenko@linux.intel.com> Subject: [PATCH v1 1/1] f2fs: Use return value of strreplace() Date: Wed, 28 Jun 2023 18:02:43 +0300 Message-Id: <20230628150243.17771-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769959959944182786?= X-GMAIL-MSGID: =?utf-8?q?1769959959944182786?= |
Series |
[v1,1/1] f2fs: Use return value of strreplace()
|
|
Commit Message
Andy Shevchenko
June 28, 2023, 3:02 p.m. UTC
Since strreplace() returns the pointer to the string itself,
we may use it directly in the code.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
include/trace/events/f2fs.h | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
Comments
On Wed, 28 Jun 2023 18:02:43 +0300 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > Since strreplace() returns the pointer to the string itself, > we may use it directly in the code. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > include/trace/events/f2fs.h | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h > index 793f82cc1515..f5994515290c 100644 > --- a/include/trace/events/f2fs.h > +++ b/include/trace/events/f2fs.h > @@ -2234,13 +2234,11 @@ DECLARE_EVENT_CLASS(f2fs__rw_start, > * because this screws up the tooling that parses > * the traces. > */ > - __assign_str(pathbuf, pathname); > - (void)strreplace(__get_str(pathbuf), ' ', '_'); > + __assign_str(pathbuf, strreplace(pathname, ' ', '_')); But this modifies the pathname that is passed into the trace event, which is something that a trace point should never do! In fact, the char *pathname, really should be a const char * (for which this would fail to build). Note, I went to look for these events and I can not find where they are used. Should these events just be deleted? -- Steve > __entry->offset = offset; > __entry->bytes = bytes; > __entry->i_size = i_size_read(inode); > - __assign_str(cmdline, command); > - (void)strreplace(__get_str(cmdline), ' ', '_'); > + __assign_str(cmdline, strreplace(command, ' ', '_')); > __entry->pid = pid; > __entry->ino = inode->i_ino; > ),
On 07/10, Steven Rostedt wrote: > On Wed, 28 Jun 2023 18:02:43 +0300 > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > > > Since strreplace() returns the pointer to the string itself, > > we may use it directly in the code. > > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > --- > > include/trace/events/f2fs.h | 6 ++---- > > 1 file changed, 2 insertions(+), 4 deletions(-) > > > > diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h > > index 793f82cc1515..f5994515290c 100644 > > --- a/include/trace/events/f2fs.h > > +++ b/include/trace/events/f2fs.h > > @@ -2234,13 +2234,11 @@ DECLARE_EVENT_CLASS(f2fs__rw_start, > > * because this screws up the tooling that parses > > * the traces. > > */ > > - __assign_str(pathbuf, pathname); > > - (void)strreplace(__get_str(pathbuf), ' ', '_'); > > + __assign_str(pathbuf, strreplace(pathname, ' ', '_')); > > But this modifies the pathname that is passed into the trace event, which > is something that a trace point should never do! In fact, the char > *pathname, really should be a const char * (for which this would fail to > build). > > Note, I went to look for these events and I can not find where they are > used. Should these events just be deleted? Hmm, this was a part of upstream effort to replace the previous android_fs tracepoints like: https://android-review.git.corp.google.com/c/platform/system/extras/+/2223339 > > -- Steve > > > > __entry->offset = offset; > > __entry->bytes = bytes; > > __entry->i_size = i_size_read(inode); > > - __assign_str(cmdline, command); > > - (void)strreplace(__get_str(cmdline), ' ', '_'); > > + __assign_str(cmdline, strreplace(command, ' ', '_')); > > __entry->pid = pid; > > __entry->ino = inode->i_ino; > > ),
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 793f82cc1515..f5994515290c 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -2234,13 +2234,11 @@ DECLARE_EVENT_CLASS(f2fs__rw_start, * because this screws up the tooling that parses * the traces. */ - __assign_str(pathbuf, pathname); - (void)strreplace(__get_str(pathbuf), ' ', '_'); + __assign_str(pathbuf, strreplace(pathname, ' ', '_')); __entry->offset = offset; __entry->bytes = bytes; __entry->i_size = i_size_read(inode); - __assign_str(cmdline, command); - (void)strreplace(__get_str(cmdline), ' ', '_'); + __assign_str(cmdline, strreplace(command, ' ', '_')); __entry->pid = pid; __entry->ino = inode->i_ino; ),