blob: f33d15f90073d95c2441e59f71aae75aa4d18aef [file] [log] [blame]
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00001From c8f96e7716404549b19b9a774f5d9987325608bc Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Wed, 26 Jan 2022 14:37:52 -0500
4Subject: [PATCH 4/7] fix: btrfs: pass fs_info to
5 trace_btrfs_transaction_commit (v5.17)
6
7See upstream commit :
8
9 commit 2e4e97abac4c95f8b87b2912ea013f7836a6f10b
10 Author: Josef Bacik <josef@toxicpanda.com>
11 Date: Fri Nov 5 16:45:29 2021 -0400
12
13 btrfs: pass fs_info to trace_btrfs_transaction_commit
14
15 The root on the trans->root can be anything, and generally we're
16 committing from the transaction kthread so it's usually the tree_root.
17 Change this to just take an fs_info, and to maintain compatibility
18 simply put the ROOT_TREE_OBJECTID as the root objectid for the
19 tracepoint. This will allow use to remove trans->root.
20
21
22Upstream-Status: Backport [lttng-modules commit c8f96e7716404549b19b9a774f5d9987325608bc]
23
24Change-Id: Ie5a4804330edabffac0714fcb9c25b8c8599e424
25Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
26Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
27---
28 include/instrumentation/events/btrfs.h | 44 ++++++++++++++++++--------
29 1 file changed, 31 insertions(+), 13 deletions(-)
30
31diff --git a/include/instrumentation/events/btrfs.h b/include/instrumentation/events/btrfs.h
32index 0a0e085a..785f16ac 100644
33--- a/include/instrumentation/events/btrfs.h
34+++ b/include/instrumentation/events/btrfs.h
35@@ -43,7 +43,19 @@ struct extent_state;
36 #define lttng_fs_info_fsid fs_info->fsid
37 #endif
38
39-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0) || \
40+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
41+LTTNG_TRACEPOINT_EVENT(btrfs_transaction_commit,
42+
43+ TP_PROTO(const struct btrfs_fs_info *fs_info),
44+
45+ TP_ARGS(fs_info),
46+
47+ TP_FIELDS(
48+ ctf_integer(u64, generation, fs_info->generation)
49+ ctf_integer(u64, root_objectid, BTRFS_ROOT_TREE_OBJECTID)
50+ )
51+)
52+#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0) || \
53 LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
54 LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
55 LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
56@@ -59,7 +71,25 @@ LTTNG_TRACEPOINT_EVENT(btrfs_transaction_commit,
57 ctf_integer(u64, root_objectid, root->root_key.objectid)
58 )
59 )
60+#else
61+LTTNG_TRACEPOINT_EVENT(btrfs_transaction_commit,
62+
63+ TP_PROTO(struct btrfs_root *root),
64+
65+ TP_ARGS(root),
66
67+ TP_FIELDS(
68+ ctf_integer(u64, generation, root->fs_info->generation)
69+ ctf_integer(u64, root_objectid, root->root_key.objectid)
70+ )
71+)
72+#endif
73+
74+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0) || \
75+ LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
76+ LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
77+ LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
78+ LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0))
79 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__inode,
80
81 TP_PROTO(const struct inode *inode),
82@@ -99,18 +129,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__inode, btrfs_inode_evict,
83 TP_ARGS(inode)
84 )
85 #else
86-LTTNG_TRACEPOINT_EVENT(btrfs_transaction_commit,
87-
88- TP_PROTO(struct btrfs_root *root),
89-
90- TP_ARGS(root),
91-
92- TP_FIELDS(
93- ctf_integer(u64, generation, root->fs_info->generation)
94- ctf_integer(u64, root_objectid, root->root_key.objectid)
95- )
96-)
97-
98 LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__inode,
99
100 TP_PROTO(struct inode *inode),
101--
1022.19.1
103