From patchwork Mon Jul 1 10:26:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13717784 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 D419BC2BD09 for ; Mon, 1 Jul 2024 10:27:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B5FD76B009C; Mon, 1 Jul 2024 06:27:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A9B9F6B009D; Mon, 1 Jul 2024 06:27:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 82BCA6B009E; Mon, 1 Jul 2024 06:27:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 4FF466B009D for ; Mon, 1 Jul 2024 06:27:21 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 0EAA4141A96 for ; Mon, 1 Jul 2024 10:27:21 +0000 (UTC) X-FDA: 82290806682.25.549E591 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf20.hostedemail.com (Postfix) with ESMTP id 9C0371C0007 for ; Mon, 1 Jul 2024 10:27:18 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=omKMtLWA; spf=pass (imf20.hostedemail.com: domain of jlayton@kernel.org designates 145.40.73.55 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=1719829628; 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=7ckLvF0CqyFpDiXyVsN3fSL2TMt8z7G5peSrLWajGOcdUcy+CNjo5M3smwBng3Fy9wY9QE KuVUqqXDzUJjyeBbjiyiwjd6Ag8hkcMo9jxrhNhDGEnR4gfZslSAYgp3weTD5CvKg8UHyz 3/AnXLDn5Pf0EHbhE8uDLr8EcOgEGFs= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=omKMtLWA; spf=pass (imf20.hostedemail.com: domain of jlayton@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=jlayton@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719829628; a=rsa-sha256; cv=none; b=VWj8UscWE1ta6kgTwv/5AM+SiOIEgPNIm1ixOiZHUhcTFTuP/F8nUNPOT+uuDZqNIk2Ldc 2lvdUErh7ttS8bszeIrumxEN7hejplbS63QdINpTlnTuZOeDHmgqAsHLrgj6WwzR8YjSEz mvhnhQZ7qNdmHA4TfJtpjSs7yVkv5ZU= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id BD26ECE1174; Mon, 1 Jul 2024 10:27:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 086F0C4AF0A; Mon, 1 Jul 2024 10:27:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719829635; bh=TvAqWM+1osikcEDt9i0N4WD9vik81z9fLBMKtBzROY8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=omKMtLWAsyL0zAsAPOLHmO/PULOiMrdAphGS7XL4KzP6SdkInnFOvrWPg8iNVA8SE O2vLzg+9P8se6O6us7xNZvZOiRvyVe6XH4EsLttxrJ562NbbpORn5fYa5Z9FbZgevX qXDhnyoFG89QoRXmS11fV84bk9fbobyzJUF+UVVU/ysy6MiPwUfK/3YkOXCVEJB8Oa xdVQkFCz2rr2x3UStE4oxMyzA3dYKPEOgg/ltdVkaUwQwIxEKUd4ieRKnYOv7+wR8R uy7OS93B3eNia1jKGcgtDsC5LDu5X5FmWvjRHZhf2FEqX5SgMdVrl6WbKOk1ilNiRs SXGE/9Yod0TbA== From: Jeff Layton Date: Mon, 01 Jul 2024 06:26:39 -0400 Subject: [PATCH v2 03/11] fs: tracepoints for inode_needs_update_time and inode_set_ctime_to_ts MIME-Version: 1.0 Message-Id: <20240701-mgtime-v2-3-19d412a940d9@kernel.org> References: <20240701-mgtime-v2-0-19d412a940d9@kernel.org> In-Reply-To: <20240701-mgtime-v2-0-19d412a940d9@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: Andi Kleen , 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/ZANAwAIAQAOaEEZVoIVAcsmYgBmgoR4fMvBS8msf2r3qrJVeLrJLPiafhklB5Y2M 2ff/OZrOoWJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZoKEeAAKCRAADmhBGVaC FewxD/wO4A1OP0QwpPBNzHvQYzQ3QKtbRRz9097tMgFKRzvc9W+rJQXTGyU01Q0frLqh5f3Ju1N +ft2f0BamL4qEFTpRkkkRX61dzmSeFYDJVCau/cNUdcnNYjx+3dm6SlBg6Y3P+mxxf7KkU32/jQ vrmQ/mlWFeK9qxwwHyUOISjol5fs7IXrNbR7PyHfQpj4GfcRd//9tSvfFlB/SecQpUbcUIkZQjW +BSOC9RSuiFVYGiWawlq9Q+O0TchkJwvXS7wj/X5hfI6C+BNnyC5c38G4u0/QIUrdoze6JU20hO UNxwHmOFBHjp+PL73EE3S3GU/+fleMJDlCOTky+50FNHnuOM+lrTZySsYH+DZOc2o7ke9EiFlOf +KL/WVDc3Cia5wKy4lh/xod+mibhHsNcGbIhcv22izrEGGnnOx+4QIFfrI2dnmAyMmHAPSgsZ1d j+0H5m0vv1lcBEIFiSVlGwyytRufnhAQJX4J9RNWkhsHBidzAPogfAZwEY4ef5se6337mLqSF35 pZnYoZV+1blWEStRGHsh383sypvnp67jYhT64JXRqGWZheHFMcyRtK5A7nUzOtAmHAOM/0gBTID K9nklzlgH+VYxyx/euDlDXvIUUbv1bITh/pJ1W7Dg+QlAY78fF/LAEknKlq/ct9/gsNQsdWUhFY xOJIKdmKn59P8HQ== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 9C0371C0007 X-Stat-Signature: r8n1rjw4ffunyr3cwh318jqt3yzofpoe X-HE-Tag: 1719829638-683303 X-HE-Meta: U2FsdGVkX18Iubu9vmk7hIiU4g1nhv0uhMoFgW9wJ/wnNRZJ5TbR5e97HV3vEAZoa66Eh8DvcQt34mlJNCWlcj5UxTgIeJplRjHfjt11e5Iaj7U8zYDRIKIUsRCrezwDW9gI8bNXjvVVqycb5wXzx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202CQ78wfxL1HzQYrggoYgifqtOj5B9otMdQpFF4Mi3dYfgZecKkTj4Bbob4SAxykwpcLulpSRTB/n2KL6L6zMc/ElU6oDY9XJlvnDj4icv6erwcEUi+pGtNAsg5bgfRPR6iCgDCK6A8PvmcHJpD7ItO4VR6SknxBftWd4DtJDivbhu+23ApW68aGamOPHpJ/lgOWQ1NIoesLvjbA== 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