xref: /linux/include/trace/events/hugetlbfs.h (revision 7f71507851fc7764b36a3221839607d3a45c2025)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM hugetlbfs
4 
5 #if !defined(_TRACE_HUGETLBFS_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_HUGETLBFS_H
7 
8 #include <linux/tracepoint.h>
9 
10 TRACE_EVENT(hugetlbfs_alloc_inode,
11 
12 	TP_PROTO(struct inode *inode, struct inode *dir, int mode),
13 
14 	TP_ARGS(inode, dir, mode),
15 
16 	TP_STRUCT__entry(
17 		__field(dev_t,		dev)
18 		__field(ino_t,		ino)
19 		__field(ino_t,		dir)
20 		__field(__u16,		mode)
21 	),
22 
23 	TP_fast_assign(
24 		__entry->dev		= inode->i_sb->s_dev;
25 		__entry->ino		= inode->i_ino;
26 		__entry->dir		= dir->i_ino;
27 		__entry->mode		= mode;
28 	),
29 
30 	TP_printk("dev %d,%d ino %lu dir %lu mode 0%o",
31 		MAJOR(__entry->dev), MINOR(__entry->dev),
32 		(unsigned long) __entry->ino,
33 		(unsigned long) __entry->dir, __entry->mode)
34 );
35 
36 DECLARE_EVENT_CLASS(hugetlbfs__inode,
37 
38 	TP_PROTO(struct inode *inode),
39 
40 	TP_ARGS(inode),
41 
42 	TP_STRUCT__entry(
43 		__field(dev_t,		dev)
44 		__field(ino_t,		ino)
45 		__field(__u16,		mode)
46 		__field(loff_t,		size)
47 		__field(unsigned int,	nlink)
48 		__field(unsigned int,	seals)
49 		__field(blkcnt_t,	blocks)
50 	),
51 
52 	TP_fast_assign(
53 		__entry->dev		= inode->i_sb->s_dev;
54 		__entry->ino		= inode->i_ino;
55 		__entry->mode		= inode->i_mode;
56 		__entry->size		= inode->i_size;
57 		__entry->nlink		= inode->i_nlink;
58 		__entry->seals		= HUGETLBFS_I(inode)->seals;
59 		__entry->blocks		= inode->i_blocks;
60 	),
61 
62 	TP_printk("dev %d,%d ino %lu mode 0%o size %lld nlink %u seals %u blocks %llu",
63 		MAJOR(__entry->dev), MINOR(__entry->dev), (unsigned long) __entry->ino,
64 		__entry->mode, __entry->size, __entry->nlink, __entry->seals,
65 		(unsigned long long)__entry->blocks)
66 );
67 
68 DEFINE_EVENT(hugetlbfs__inode, hugetlbfs_evict_inode,
69 
70 	TP_PROTO(struct inode *inode),
71 
72 	TP_ARGS(inode)
73 );
74 
75 DEFINE_EVENT(hugetlbfs__inode, hugetlbfs_free_inode,
76 
77 	TP_PROTO(struct inode *inode),
78 
79 	TP_ARGS(inode)
80 );
81 
82 TRACE_EVENT(hugetlbfs_setattr,
83 
84 	TP_PROTO(struct inode *inode, struct dentry *dentry,
85 		struct iattr *attr),
86 
87 	TP_ARGS(inode, dentry, attr),
88 
89 	TP_STRUCT__entry(
90 		__field(dev_t,		dev)
91 		__field(ino_t,		ino)
92 		__field(unsigned int,	d_len)
93 		__string(d_name,	dentry->d_name.name)
94 		__field(unsigned int,	ia_valid)
95 		__field(unsigned int,	ia_mode)
96 		__field(loff_t,		old_size)
97 		__field(loff_t,		ia_size)
98 	),
99 
100 	TP_fast_assign(
101 		__entry->dev		= inode->i_sb->s_dev;
102 		__entry->ino		= inode->i_ino;
103 		__entry->d_len		= dentry->d_name.len;
104 		__assign_str(d_name);
105 		__entry->ia_valid	= attr->ia_valid;
106 		__entry->ia_mode	= attr->ia_mode;
107 		__entry->old_size	= inode->i_size;
108 		__entry->ia_size	= attr->ia_size;
109 	),
110 
111 	TP_printk("dev %d,%d ino %lu name %.*s valid %#x mode 0%o old_size %lld size %lld",
112 		MAJOR(__entry->dev), MINOR(__entry->dev), (unsigned long)__entry->ino,
113 		__entry->d_len, __get_str(d_name), __entry->ia_valid, __entry->ia_mode,
114 		__entry->old_size, __entry->ia_size)
115 );
116 
117 TRACE_EVENT(hugetlbfs_fallocate,
118 
119 	TP_PROTO(struct inode *inode, int mode,
120 		loff_t offset, loff_t len, int ret),
121 
122 	TP_ARGS(inode, mode, offset, len, ret),
123 
124 	TP_STRUCT__entry(
125 		__field(dev_t,		dev)
126 		__field(ino_t,		ino)
127 		__field(int,		mode)
128 		__field(loff_t,		offset)
129 		__field(loff_t,		len)
130 		__field(loff_t,		size)
131 		__field(int,		ret)
132 	),
133 
134 	TP_fast_assign(
135 		__entry->dev		= inode->i_sb->s_dev;
136 		__entry->ino		= inode->i_ino;
137 		__entry->mode		= mode;
138 		__entry->offset		= offset;
139 		__entry->len		= len;
140 		__entry->size		= inode->i_size;
141 		__entry->ret		= ret;
142 	),
143 
144 	TP_printk("dev %d,%d ino %lu mode 0%o offset %lld len %lld size %lld ret %d",
145 		MAJOR(__entry->dev), MINOR(__entry->dev),
146 		(unsigned long)__entry->ino, __entry->mode,
147 		(unsigned long long)__entry->offset,
148 		(unsigned long long)__entry->len,
149 		(unsigned long long)__entry->size,
150 		__entry->ret)
151 );
152 
153 #endif /* _TRACE_HUGETLBFS_H */
154 
155  /* This part must be outside protection */
156 #include <trace/define_trace.h>
157