From patchwork Thu Jun 27 01:00:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13713675 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 80766C30653 for ; Thu, 27 Jun 2024 01:00:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 62A4A6B00B6; Wed, 26 Jun 2024 21:00:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5AE666B00B7; Wed, 26 Jun 2024 21:00:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 44ED36B00B8; Wed, 26 Jun 2024 21:00:44 -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 1A92A6B00B6 for ; Wed, 26 Jun 2024 21:00:44 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id C23AFC1825 for ; Thu, 27 Jun 2024 01:00:43 +0000 (UTC) X-FDA: 82274863566.20.519FB18 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf11.hostedemail.com (Postfix) with ESMTP id 02AF540022 for ; Thu, 27 Jun 2024 01:00:41 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ksKFkOIP; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf11.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719450023; 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=CEbmpuovWZg11HIw93Qn3x7IEhnefIXy04xLDYqx/cw=; b=FcPlm4PQOrxiYuSMk54onlqQjZqi54FI/X4rQbapbg64d5HPg7kjOyWokjX4f0uh6fqeqK xVeluavzOIHB0ji/52Xr9AG2uaIomqmQzpKDHagdfhybCFFpgXtJzvzFJYJIZ0RTKFTBK8 MBI1fguaeXqrcSxjfObQFcfjy+AcEJ4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719450023; a=rsa-sha256; cv=none; b=L/YMAJhVEnJ13vZ0nuzmuDhwEmqtJWAiS+XkSlo/U38ihOJxuDu6SVilN9MmbDwXFKxeZs 5cJG/opVX8BQK5x8Hf+4a3QK9RlrdkhCZYK5AFIhBUOtJ4a/rw11ch2mBnRBFMtrnS5GGO 41NG2b/6TQDlNu9frPgmL0adeLzWIzI= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ksKFkOIP; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf11.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 262DF61D74; Thu, 27 Jun 2024 01:00:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAC7AC4AF0B; Thu, 27 Jun 2024 01:00:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719450040; bh=TvAqWM+1osikcEDt9i0N4WD9vik81z9fLBMKtBzROY8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ksKFkOIPD8B+IxtigbTwAuwg7Zi3C4sksnJDk2qwCJDFyBnx1CPl9lxXsmpzlgulQ oLA6EsYD01q3aGiBq4BfIGKTX52cJ08PoKvb/WjeTLD7aXGncsmrJ5iQqkIs6koBN5 PntCYREhRs+JdmWkpQPu4EYd2sOl9h5/ef20IY8uXouz6gRCbIZn6/h+Cu9qX++hGI wWq1wfUzUDxJm8GlIJ7HqUjuKqY4jEcJInvTHEOkFgVNG8iGkrKAsAUbep1WEVNkDa 7//UcWBy59SpfzyrHYM9wjhLB9RsJ7Qt0zcefYSVywwoenGVR3Jq4SIO75qebeN1JB Cb1MI9Oqjs3LQ== From: Jeff Layton Date: Wed, 26 Jun 2024 21:00:23 -0400 Subject: [PATCH 03/10] fs: tracepoints for inode_needs_update_time and inode_set_ctime_to_ts MIME-Version: 1.0 Message-Id: <20240626-mgtime-v1-3-a189352d0f8f@kernel.org> References: <20240626-mgtime-v1-0-a189352d0f8f@kernel.org> In-Reply-To: <20240626-mgtime-v1-0-a189352d0f8f@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 Cc: 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, Jeff Layton X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3425; i=jlayton@kernel.org; h=from:subject:message-id; bh=TvAqWM+1osikcEDt9i0N4WD9vik81z9fLBMKtBzROY8=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBmfLmu38o34Gc3uLqCC/KtRitsdQUwQQbBScUNZ xY97hHdyEiJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZny5rgAKCRAADmhBGVaC FUP6EACD4iVg9GXP9iA3Hn8lRNdHlGJ6Zy6M9ZhDcO6x6OiRZzdFfP0NgHKsFPdn2OnfETkahlZ GUYNkkiTUcbmS8kx8uGOv0t2By1BwU5Gig2xbUvCChWSNLlpJhfcSACoiyd3Z59dwnqyIlknHWL 8lAD6m4QwwRpgRn8dz96Nbern/BwQ0MwgiSe7fxAD3xczDWM9eA7g9oxyCUy0x4Cgm+whV328Z9 hVdTS7f3eBcfHjWyeP1EnceVlTAsZs55rwZp/uq53sUR8IZE31t8KK3XM2rOrGg6SXH51CWroSb 45P0mbHembc5ibT3BDy30BAAEXJscI/6aAaL1BfiROPo1JseAG/df7eQmzoAmTlFy9t+UvqCnhd 7c2goYMJrTEA3tUyWUa0RwqW6+bDSu3Gv2LxV4qNB0WaQF/rIGLZ6hdnysOdxXn80tLhbfatHuX YGY/56WUTpv9/Z5ooc6sHzggBFFcg0dFcPodRFmWgU4xTPL/xHRvRCpRSMLnPdW7mv4n3eswylP Q6K9QndkigtGk0lmq2U3HKGnXQR0K5wAJa9j1z1I3itPf1HVhdOxbBdQo5JOWaCOpXwovRowb4v pAEjUph2heWJ8O4jIFjj59Ct5FN1CInMMqtcROERa4vnmgpo4B2FVbZ8yTNqEDCkpdZaG2hby5r 9MAyoeJnmKNLXKw== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 02AF540022 X-Stat-Signature: 534nmrzxwn5dktfhwbom8insc4iiuq95 X-Rspam-User: X-HE-Tag: 1719450041-57208 X-HE-Meta: U2FsdGVkX1/HWXdl2eLw/uX6ErK0Zi4RclsYNLRJQDjz1R2BcudxDmtn5RmeDAQNirIKXjRr2Ema5gG7u2eCeJeGIyTu5HAyWsbSRgNMOGoFRZcn+qepTHk4SZkN939zUGcxJ2vxgc0Yv25Zy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GC5eCK2+fVUk436bfzG2AgGK/kDUt53vWMi4JaNDIdFtgyTRG81iS8fy/iRfHXSgPs2sp3+Iej9saUsCFWc8Ssxvn7Ap1Y/j9Q= 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 a new tracepoint for when we're testing whether the timestamps need updating, and around the update itself. Signed-off-by: Jeff Layton --- fs/inode.c | 4 +++ include/trace/events/timestamp.h | 76 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/fs/inode.c b/fs/inode.c index 7b0a73ed499d..5d2b0dfe48c3 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -22,6 +22,8 @@ #include #include #include +#define CREATE_TRACE_POINTS +#include #include "internal.h" /* @@ -2096,6 +2098,7 @@ static int inode_needs_update_time(struct inode *inode) if (IS_I_VERSION(inode) && inode_iversion_need_inc(inode)) sync_it |= S_VERSION; + trace_inode_needs_update_time(inode, &now, &ts, sync_it); return sync_it; } @@ -2522,6 +2525,7 @@ EXPORT_SYMBOL(inode_get_ctime); struct timespec64 inode_set_ctime_to_ts(struct inode *inode, struct timespec64 ts) { inode->__i_ctime = ktime_set(ts.tv_sec, ts.tv_nsec); + trace_inode_set_ctime_to_ts(inode, &ts); return ts; } EXPORT_SYMBOL(inode_set_ctime_to_ts); diff --git a/include/trace/events/timestamp.h b/include/trace/events/timestamp.h new file mode 100644 index 000000000000..35ff875d3800 --- /dev/null +++ b/include/trace/events/timestamp.h @@ -0,0 +1,76 @@ +/* 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_needs_update_time, + TP_PROTO(struct inode *inode, + struct timespec64 *now, + struct timespec64 *ctime, + int sync_it), + + TP_ARGS(inode, now, ctime, sync_it), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(time64_t, now_sec) + __field(time64_t, ctime_sec) + __field(long, now_nsec) + __field(long, ctime_nsec) + __field(int, sync_it) + ), + + TP_fast_assign( + __entry->dev = inode->i_sb->s_dev; + __entry->ino = inode->i_ino; + __entry->sync_it = sync_it; + __entry->now_sec = now->tv_sec; + __entry->ctime_sec = ctime->tv_sec; + __entry->now_nsec = now->tv_nsec; + __entry->ctime_nsec = ctime->tv_nsec; + __entry->sync_it = sync_it; + ), + + TP_printk("ino=%d:%d:%ld sync_it=%d now=%llu.%ld ctime=%llu.%lu", + MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino, + __entry->sync_it, + __entry->now_sec, __entry->now_nsec, + __entry->ctime_sec, __entry->ctime_nsec + ) +); + +TRACE_EVENT(inode_set_ctime_to_ts, + TP_PROTO(struct inode *inode, + struct timespec64 *ts), + + TP_ARGS(inode, ts), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(time64_t, ts_sec) + __field(long, ts_nsec) + ), + + TP_fast_assign( + __entry->dev = inode->i_sb->s_dev; + __entry->ino = inode->i_ino; + __entry->ts_sec = ts->tv_sec; + __entry->ts_nsec = ts->tv_nsec; + ), + + TP_printk("ino=%d:%d:%ld ts=%llu.%lu", + MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino, + __entry->ts_sec, __entry->ts_nsec + ) +); +#endif /* _TRACE_TIMESTAMP_H */ + +/* This part must be outside protection */ +#include