Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp35563621rwd; Mon, 10 Jul 2023 09:09:41 -0700 (PDT) X-Google-Smtp-Source: APBJJlGMWgjljg3/YrZCA4KPj08k0Jwdl977c+M4YSkS9cIE6vMyPN29DZtWmI1SYVhY/51uB9zV X-Received: by 2002:a05:6402:64e:b0:51e:fd3:ae5f with SMTP id u14-20020a056402064e00b0051e0fd3ae5fmr13692483edx.19.1689005380768; Mon, 10 Jul 2023 09:09:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689005380; cv=none; d=google.com; s=arc-20160816; b=eVHb8ACINXtcEuHPU2T7OWyk3THqKOBqJ9mP/rgThLywSwvbS/uGVILP6ZsEWfXrxu tmpcNyY7clG+MOBm7vH3nNXqXLT24C0eJo5Cckag6HckrahenzqVnZ5G+h56e5/eWB3/ oN6NvciK/PWCNYCAyGGObt16YKTB/dLbJup43cvTWfQ70qbr82cmev002thDeEJc8z+O NLWLBv3gqMeAVzuD5XJxwJhsR5htn7Uo1FFnGHLbVtEofAD/BUJsHjuYAbjfM6akTEZn XLhBHROTTaVwB9Dn5tz/4TTrVAoR/M2jz/r439WAwGJgEUfPldq5H3PGLcbRn24V+d3h +93A== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=MYHhXeZncBFVkr0gCMft1wtgFFv9azrQBwXOQsNrw2I=; fh=1jdIHoc10amC1imFyH9GRCjjPQAzyBGf6qc2Or9fkQE=; b=0Xs/lMWQAxM1pQhijdwrUM3nKVroo6xpSMNGvUcSboCrh3XuItpjdDcgudWQ5I1p+j PTMwEbJBdUxJQhd5XYBpVBLCIjLTNZ6n7AZbsiuk5mwwtlj9RifYAvsGPHvzzU3S7tPz py5dgagx/I9L8t3AXJyeOgz5ciQX8w5G/+r3iDU930bPb4dK1fl6TI1NYtyd6PVFX8dG kT6DJYKQfh6HoqUJ4EQXEE0HsDmfbeDWt4rAMR9iEaVFeNXou9W5oqslA8u8pVkhWZwG C0heIEoYGYXgPKMD4O1XdSw2T76bySeoTLcBYjQu26hVcKMZlTs44hmLdk2sB9U7LFHL LDFw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f15-20020a056402160f00b0051e0caa2768si9569397edv.129.2023.07.10.09.09.16; Mon, 10 Jul 2023 09:09:40 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232181AbjGJPRI (ORCPT + 99 others); Mon, 10 Jul 2023 11:17:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230300AbjGJPRH (ORCPT ); Mon, 10 Jul 2023 11:17:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90001B7; Mon, 10 Jul 2023 08:17:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2EEB96105C; Mon, 10 Jul 2023 15:17:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1879C433C8; Mon, 10 Jul 2023 15:17:04 +0000 (UTC) Date: Mon, 10 Jul 2023 11:17:03 -0400 From: Steven Rostedt To: Zehao Zhang Cc: linkinjeon@kernel.org, sj1557.seo@samsung.com, mhiramat@kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: Re: [PATCH] exfat: Add ftrace support for exfat and add some tracepoints Message-ID: <20230710111703.33bb48c5@gandalf.local.home> In-Reply-To: <20230710092559.19087-1-zhangzehao@vivo.com> References: <20230710092559.19087-1-zhangzehao@vivo.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Mon, 10 Jul 2023 17:25:59 +0800 Zehao Zhang wrote: > Add ftrace support for exFAT file system, > and add some tracepoints: > exfat_read_folio(), exfat_writepages(), exfat_write_begin(), > exfat_write_end(), exfat_lookup_start(), exfat_lookup_end() > > exfat_read_folio(): > shows the dev number, inode and the folio index. > > exfat_writepages(): > shows the inode and fields in struct writeback_control. > > exfat_write_begin(): > shows the inode, file position offset and length. > > exfat_write_end(): > shows the inode, file position offset, bytes write to page > and bytes copied from user. > > exfat_lookup_start(): > shows the target inode, dentry and flags. > > exfat_lookup_end(): > shows the target inode, dentry and err code. > > Signed-off-by: Zehao Zhang > --- > MAINTAINERS | 1 + > fs/exfat/inode.c | 16 +++ > fs/exfat/namei.c | 10 +- > include/trace/events/exfat.h | 192 +++++++++++++++++++++++++++++++++++ > 4 files changed, 218 insertions(+), 1 deletion(-) > create mode 100644 include/trace/events/exfat.h > > diff --git a/MAINTAINERS b/MAINTAINERS > index 4f115c355a41..fbe1caa61a38 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -7752,6 +7752,7 @@ L: linux-fsdevel@vger.kernel.org > S: Maintained > T: git git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat.git > F: fs/exfat/ > +F: include/trace/events/exfat.h > > EXT2 FILE SYSTEM > M: Jan Kara > diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c > index 481dd338f2b8..48fec3fa10af 100644 > --- a/fs/exfat/inode.c > +++ b/fs/exfat/inode.c > @@ -17,6 +17,9 @@ > #include "exfat_raw.h" > #include "exfat_fs.h" > > +#define CREATE_TRACE_POINTS > +#include > + > int __exfat_write_inode(struct inode *inode, int sync) > { > unsigned long long on_disk_size; > @@ -335,6 +338,10 @@ static int exfat_get_block(struct inode *inode, sector_t iblock, > > static int exfat_read_folio(struct file *file, struct folio *folio) > { > + struct inode *inode = folio->mapping->host; Why dereference here and not just use the folio that is passed in? That will keep the dereferencing logic out of the code path and only happen when the trace event is enabled. > + > + trace_exfat_read_folio(inode, folio); > + > return mpage_read_folio(folio, exfat_get_block); > } > > @@ -346,6 +353,10 @@ static void exfat_readahead(struct readahead_control *rac) > static int exfat_writepages(struct address_space *mapping, > struct writeback_control *wbc) > { > + struct inode *inode = mapping->host; > + > + trace_exfat_writepages(inode, wbc); Here you could just pass in mapping and do the dereference in the TP_fast_assign(). > + > return mpage_writepages(mapping, wbc, exfat_get_block); > } > > @@ -364,6 +375,7 @@ static int exfat_write_begin(struct file *file, struct address_space *mapping, > loff_t pos, unsigned int len, > struct page **pagep, void **fsdata) > { > + struct inode *inode = mapping->host; And here too. -- Steve > int ret; > > *pagep = NULL; > @@ -371,6 +383,8 @@ static int exfat_write_begin(struct file *file, struct address_space *mapping, > exfat_get_block, > &EXFAT_I(mapping->host)->i_size_ondisk); > > + trace_exfat_write_begin(inode, pos, len); > + > if (ret < 0) > exfat_write_failed(mapping, pos+len); > > @@ -394,6 +408,8 @@ static int exfat_write_end(struct file *file, struct address_space *mapping, > return -EIO; > } > > + trace_exfat_write_end(inode, pos, len, copied); > + > if (err < len) > exfat_write_failed(mapping, pos+len); >