From patchwork Thu Jul 11 11:08:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13730387 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61DF3C3DA4B for ; Thu, 11 Jul 2024 11:08:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 01D936B0089; Thu, 11 Jul 2024 07:08:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EA1906B0092; Thu, 11 Jul 2024 07:08:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C4FD46B008A; Thu, 11 Jul 2024 07:08:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 833FC6B008A for ; Thu, 11 Jul 2024 07:08:34 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 3F1771A052C for ; Thu, 11 Jul 2024 11:08:34 +0000 (UTC) X-FDA: 82327198548.24.67E0393 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf02.hostedemail.com (Postfix) with ESMTP id 64A1780005 for ; Thu, 11 Jul 2024 11:08:32 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=CLLmbufx; spf=pass (imf02.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720696080; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=WVBLt75swVv5iMyyNNvSkcEY0JqTDn74BYiJHjE/vc8=; b=4O1zYDQri1frmGcx1caUX8JOtFrDJYYcX2cMc2WbavbeGmPRJLmwDNAYGuOEw2dQ5AE+Qq Rbh9fK47CuGsQpYKUxpqYCF06EZYdpTeznScCf+OlzmerdSwJSiRg0LGWi0OX64uLZw41j mHQ4crQSYzcUJcCJrbcW9orZzLHnk+c= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720696080; a=rsa-sha256; cv=none; b=f0MTT2OaF2GcY7DMpogMkThb1TUbb6P1ROFkcFR5a/OecLy6VEd30p2mhNwS3JGfFpPZrG 1adNY7mnyu8vxR7iTjbzUW51TGyu8RznxbnMOoCQHGPCC7ZjgmsswBkiAIs5b8qokQc+/b MnZO4S+hhAh0GmP1gxvT3ElagFPDbuc= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=CLLmbufx; spf=pass (imf02.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 4357A61D0D; Thu, 11 Jul 2024 11:08:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28D80C4AF07; Thu, 11 Jul 2024 11:08:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720696111; bh=rFzpgz1HqOKOCLh7b0SiDnaZS+NN3RBwFhHtuP1qUx4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=CLLmbufxrMwqRIxsj3EShlbrXkeTe6QolAUV6OjeFmXNDxMrS8FgaZD5fet1zUGYK EuTAGivoIefR/QittNO1F0NVIxe/dS51KBHibbHueFnUadb5ve6vJiRuNL2BMH5unO bLpDY+VzZFC8jCXRma6W6JQ8FpSb3gi5uf6XgsV7RdM829lo6SghJDd4296X49b5Gp LRQ2TDjlvJBkDsNpa9lfKHTLunLNPiPQi9eaelK17ZwAOtk9XL3AgFLnOraT72P6Z8 eL1ItkUDt2fNUTMY8+d2jrdYOaOqk9huYtOczCijmsagZL4hsS518H2PdT4GMoXDYL GB+1wxSKonsRA== From: Jeff Layton Date: Thu, 11 Jul 2024 07:08:06 -0400 Subject: [PATCH v5 2/9] fs: tracepoints around multigrain timestamp events MIME-Version: 1.0 Message-Id: <20240711-mgtime-v5-2-37bb5b465feb@kernel.org> References: <20240711-mgtime-v5-0-37bb5b465feb@kernel.org> In-Reply-To: <20240711-mgtime-v5-0-37bb5b465feb@kernel.org> To: Alexander Viro , Christian Brauner , Jan Kara , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Chandan Babu R , "Darrick J. Wong" , Theodore Ts'o , Andreas Dilger , Chris Mason , Josef Bacik , David Sterba , Hugh Dickins , Andrew Morton , Jonathan Corbet Cc: Dave Chinner , Andi Kleen , Christoph Hellwig , Uros Bizjak , Kent Overstreet , Arnd Bergmann , Randy Dunlap , kernel-team@fb.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org, linux-doc@vger.kernel.org, Jeff Layton X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5096; i=jlayton@kernel.org; h=from:subject:message-id; bh=rFzpgz1HqOKOCLh7b0SiDnaZS+NN3RBwFhHtuP1qUx4=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBmj70kIZqRBAr9twF69KZlGMkMn1TAN28mNNhTf ngIzrb7jvWJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZo+9JAAKCRAADmhBGVaC FX5SD/9yMgo83hVnTouqwh7Wudzs0Jud5XixMFsw35LiO08WfJQztDhsi7MJ6lxuIejoTHfuqus zAkkVjU1NHU1aPGZM1LaW8NY+PM5Vm0rg1H3Tp8LWaxM4u/kapfjM0f6xep+yI75SHRBm2T00Yu I0nrE8Ymxm8IwMju/5dPeqZG4gWibKcorgyLgv4TAmwfmidRhjYRIALqhKMAN+Zc2OCBLG48VMS foedmx1f1jk/Kv5n9NDlIFT6BNGhZrGahDsqXM5UaTVTksmsnXUL/o/neOWINHggU6rvsjS72SL ygap7ep9ZUCBW7Lh8t3Zm/htJpqnwBw6c7NvDCjFa4JBYo4v+6Jqbxkgy1qO/A7rCLhmnfQE2sv /SnXaHKUznyFIl0sOa4xvOln1B14jAlfpxmcUE/e3NWkb6Bzb+TxMujcTXnuVFUrepr/WsCnsU7 gzVw9Q/HcugitbGMkQgmeWtGtGfYHKUmf+LPetEcK8lPO95Gq5Bk5KRgVfoPTN5hX9vX8vVq36J TFbun/sDhI9A7eWtnr7ZkYbo9D71S6Iq+FQGQf3WeWlWqx77ThDn/39obkMI2vV/2/95kFnM+hw G1nCZSOkBoc/K5bQqsbxktIJueJou5XmijV4ZvXD0O4dC9kciGPM5YYI3NrMs3YdqjZwhI9KyRG 9mD08b4tXRCD0fg== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Queue-Id: 64A1780005 X-Stat-Signature: ik3ein6r4685fexpkpf7i6ce111kfawz X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1720696112-526216 X-HE-Meta: U2FsdGVkX18LUbnzgA0KgAqLHVDl/T7MDUpOF2P4ZETWru363yu8N6QB2J3pkVwoTrZOTYZ3KeNxKJieJEohhgt6rj0zyLn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X8Pg8JSNObnrHo5Dv4nmaRd6vT9AWkLL/m5QoMQS+lXZHu1EdV7EdbkfjrSIAs1+Zdn0GxM1RK X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Add some tracepoints around various multigrain timestamp events. Signed-off-by: Jeff Layton --- fs/inode.c | 5 ++ fs/stat.c | 3 ++ include/trace/events/timestamp.h | 109 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+) diff --git a/fs/inode.c b/fs/inode.c index 2b5889ff7b36..81b45e0a95a6 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -22,6 +22,9 @@ #include #include #include +#define CREATE_TRACE_POINTS +#include + #include "internal.h" /* @@ -2571,6 +2574,7 @@ struct timespec64 inode_set_ctime_to_ts(struct inode *inode, struct timespec64 t { inode->i_ctime_sec = ts.tv_sec; inode->i_ctime_nsec = ts.tv_nsec & ~I_CTIME_QUERIED; + trace_inode_set_ctime_to_ts(inode, &ts); return ts; } EXPORT_SYMBOL(inode_set_ctime_to_ts); @@ -2670,6 +2674,7 @@ struct timespec64 inode_set_ctime_current(struct inode *inode) if (try_cmpxchg(&inode->i_ctime_nsec, &cur, now_ts.tv_nsec)) { /* If swap occurred, then we're (mostly) done */ inode->i_ctime_sec = now_ts.tv_sec; + trace_ctime_ns_xchg(inode, cns, now_ts.tv_nsec, cur); } else { /* * Was the change due to someone marking the old ctime QUERIED? diff --git a/fs/stat.c b/fs/stat.c index df7fdd3afed9..552dfd67688b 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -23,6 +23,8 @@ #include #include +#include + #include "internal.h" #include "mount.h" @@ -49,6 +51,7 @@ void fill_mg_cmtime(struct kstat *stat, u32 request_mask, struct inode *inode) stat->mtime = inode_get_mtime(inode); stat->ctime.tv_sec = inode->i_ctime_sec; stat->ctime.tv_nsec = ((u32)atomic_fetch_or(I_CTIME_QUERIED, pcn)) & ~I_CTIME_QUERIED; + trace_fill_mg_cmtime(inode, &stat->ctime, &stat->mtime); } EXPORT_SYMBOL(fill_mg_cmtime); diff --git a/include/trace/events/timestamp.h b/include/trace/events/timestamp.h new file mode 100644 index 000000000000..3a603190b46c --- /dev/null +++ b/include/trace/events/timestamp.h @@ -0,0 +1,109 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM timestamp + +#if !defined(_TRACE_TIMESTAMP_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_TIMESTAMP_H + +#include +#include + +TRACE_EVENT(inode_set_ctime_to_ts, + TP_PROTO(struct inode *inode, + struct timespec64 *ctime), + + TP_ARGS(inode, ctime), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(time64_t, ctime_s) + __field(u32, ctime_ns) + __field(u32, gen) + ), + + TP_fast_assign( + __entry->dev = inode->i_sb->s_dev; + __entry->ino = inode->i_ino; + __entry->gen = inode->i_generation; + __entry->ctime_s = ctime->tv_sec; + __entry->ctime_ns = ctime->tv_nsec; + ), + + TP_printk("ino=%d:%d:%ld:%u ctime=%lld.%u", + MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino, __entry->gen, + __entry->ctime_s, __entry->ctime_ns + ) +); + +TRACE_EVENT(ctime_ns_xchg, + TP_PROTO(struct inode *inode, + u32 old, + u32 new, + u32 cur), + + TP_ARGS(inode, old, new, cur), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(u32, gen) + __field(u32, old) + __field(u32, new) + __field(u32, cur) + ), + + TP_fast_assign( + __entry->dev = inode->i_sb->s_dev; + __entry->ino = inode->i_ino; + __entry->gen = inode->i_generation; + __entry->old = old; + __entry->new = new; + __entry->cur = cur; + ), + + TP_printk("ino=%d:%d:%ld:%u old=%u:%c new=%u cur=%u:%c", + MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino, __entry->gen, + __entry->old & ~I_CTIME_QUERIED, __entry->old & I_CTIME_QUERIED ? 'Q' : '-', + __entry->new, + __entry->cur & ~I_CTIME_QUERIED, __entry->cur & I_CTIME_QUERIED ? 'Q' : '-' + ) +); + +TRACE_EVENT(fill_mg_cmtime, + TP_PROTO(struct inode *inode, + struct timespec64 *ctime, + struct timespec64 *mtime), + + TP_ARGS(inode, ctime, mtime), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(time64_t, ctime_s) + __field(time64_t, mtime_s) + __field(u32, ctime_ns) + __field(u32, mtime_ns) + __field(u32, gen) + ), + + TP_fast_assign( + __entry->dev = inode->i_sb->s_dev; + __entry->ino = inode->i_ino; + __entry->gen = inode->i_generation; + __entry->ctime_s = ctime->tv_sec; + __entry->mtime_s = mtime->tv_sec; + __entry->ctime_ns = ctime->tv_nsec; + __entry->mtime_ns = mtime->tv_nsec; + ), + + TP_printk("ino=%d:%d:%ld:%u ctime=%lld.%u mtime=%lld.%u", + MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino, __entry->gen, + __entry->ctime_s, __entry->ctime_ns, + __entry->mtime_s, __entry->mtime_ns + ) +); +#endif /* _TRACE_TIMESTAMP_H */ + +/* This part must be outside protection */ +#include