Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / include / trace / events / erofs.h
blob57df3843e650c9bbf3ef91d36d22539b5d8288bc
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM erofs
5 #if !defined(_TRACE_EROFS_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_EROFS_H
8 #include <linux/tracepoint.h>
9 #include <linux/fs.h>
11 struct erofs_map_blocks;
13 #define show_dev(dev) MAJOR(dev), MINOR(dev)
14 #define show_dev_nid(entry) show_dev(entry->dev), entry->nid
16 #define show_file_type(type) \
17 __print_symbolic(type, \
18 { 0, "FILE" }, \
19 { 1, "DIR" })
21 #define show_map_flags(flags) __print_flags(flags, "|", \
22 { EROFS_GET_BLOCKS_FIEMAP, "FIEMAP" }, \
23 { EROFS_GET_BLOCKS_READMORE, "READMORE" }, \
24 { EROFS_GET_BLOCKS_FINDTAIL, "FINDTAIL" })
26 #define show_mflags(flags) __print_flags(flags, "", \
27 { EROFS_MAP_MAPPED, "M" }, \
28 { EROFS_MAP_META, "I" }, \
29 { EROFS_MAP_ENCODED, "E" }, \
30 { EROFS_MAP_FULL_MAPPED, "F" }, \
31 { EROFS_MAP_FRAGMENT, "R" }, \
32 { EROFS_MAP_PARTIAL_REF, "P" })
34 TRACE_EVENT(erofs_lookup,
36 TP_PROTO(struct inode *dir, struct dentry *dentry, unsigned int flags),
38 TP_ARGS(dir, dentry, flags),
40 TP_STRUCT__entry(
41 __field(dev_t, dev )
42 __field(erofs_nid_t, nid )
43 __string(name, dentry->d_name.name )
44 __field(unsigned int, flags )
47 TP_fast_assign(
48 __entry->dev = dir->i_sb->s_dev;
49 __entry->nid = EROFS_I(dir)->nid;
50 __assign_str(name);
51 __entry->flags = flags;
54 TP_printk("dev = (%d,%d), pnid = %llu, name:%s, flags:%x",
55 show_dev_nid(__entry),
56 __get_str(name),
57 __entry->flags)
60 TRACE_EVENT(erofs_fill_inode,
61 TP_PROTO(struct inode *inode),
62 TP_ARGS(inode),
64 TP_STRUCT__entry(
65 __field(dev_t, dev )
66 __field(erofs_nid_t, nid )
67 __field(erofs_blk_t, blkaddr )
68 __field(unsigned int, ofs )
71 TP_fast_assign(
72 __entry->dev = inode->i_sb->s_dev;
73 __entry->nid = EROFS_I(inode)->nid;
74 __entry->blkaddr = erofs_blknr(inode->i_sb, erofs_iloc(inode));
75 __entry->ofs = erofs_blkoff(inode->i_sb, erofs_iloc(inode));
78 TP_printk("dev = (%d,%d), nid = %llu, blkaddr %u ofs %u",
79 show_dev_nid(__entry),
80 __entry->blkaddr, __entry->ofs)
83 TRACE_EVENT(erofs_read_folio,
85 TP_PROTO(struct folio *folio, bool raw),
87 TP_ARGS(folio, raw),
89 TP_STRUCT__entry(
90 __field(dev_t, dev )
91 __field(erofs_nid_t, nid )
92 __field(int, dir )
93 __field(pgoff_t, index )
94 __field(int, uptodate)
95 __field(bool, raw )
98 TP_fast_assign(
99 __entry->dev = folio->mapping->host->i_sb->s_dev;
100 __entry->nid = EROFS_I(folio->mapping->host)->nid;
101 __entry->dir = S_ISDIR(folio->mapping->host->i_mode);
102 __entry->index = folio->index;
103 __entry->uptodate = folio_test_uptodate(folio);
104 __entry->raw = raw;
107 TP_printk("dev = (%d,%d), nid = %llu, %s, index = %lu, uptodate = %d "
108 "raw = %d",
109 show_dev_nid(__entry),
110 show_file_type(__entry->dir),
111 (unsigned long)__entry->index,
112 __entry->uptodate,
113 __entry->raw)
116 TRACE_EVENT(erofs_readpages,
118 TP_PROTO(struct inode *inode, pgoff_t start, unsigned int nrpage,
119 bool raw),
121 TP_ARGS(inode, start, nrpage, raw),
123 TP_STRUCT__entry(
124 __field(dev_t, dev )
125 __field(erofs_nid_t, nid )
126 __field(pgoff_t, start )
127 __field(unsigned int, nrpage )
128 __field(bool, raw )
131 TP_fast_assign(
132 __entry->dev = inode->i_sb->s_dev;
133 __entry->nid = EROFS_I(inode)->nid;
134 __entry->start = start;
135 __entry->nrpage = nrpage;
136 __entry->raw = raw;
139 TP_printk("dev = (%d,%d), nid = %llu, start = %lu nrpage = %u raw = %d",
140 show_dev_nid(__entry),
141 (unsigned long)__entry->start,
142 __entry->nrpage,
143 __entry->raw)
146 TRACE_EVENT(erofs_map_blocks_enter,
148 TP_PROTO(struct inode *inode, struct erofs_map_blocks *map,
149 unsigned int flags),
151 TP_ARGS(inode, map, flags),
153 TP_STRUCT__entry(
154 __field( dev_t, dev )
155 __field( erofs_nid_t, nid )
156 __field( erofs_off_t, la )
157 __field( u64, llen )
158 __field( unsigned int, flags )
161 TP_fast_assign(
162 __entry->dev = inode->i_sb->s_dev;
163 __entry->nid = EROFS_I(inode)->nid;
164 __entry->la = map->m_la;
165 __entry->llen = map->m_llen;
166 __entry->flags = flags;
169 TP_printk("dev = (%d,%d), nid = %llu, la %llu llen %llu flags %s",
170 show_dev_nid(__entry),
171 __entry->la, __entry->llen,
172 __entry->flags ? show_map_flags(__entry->flags) : "NULL")
175 TRACE_EVENT(erofs_map_blocks_exit,
177 TP_PROTO(struct inode *inode, struct erofs_map_blocks *map,
178 unsigned int flags, int ret),
180 TP_ARGS(inode, map, flags, ret),
182 TP_STRUCT__entry(
183 __field( dev_t, dev )
184 __field( erofs_nid_t, nid )
185 __field( unsigned int, flags )
186 __field( erofs_off_t, la )
187 __field( erofs_off_t, pa )
188 __field( u64, llen )
189 __field( u64, plen )
190 __field( unsigned int, mflags )
191 __field( int, ret )
194 TP_fast_assign(
195 __entry->dev = inode->i_sb->s_dev;
196 __entry->nid = EROFS_I(inode)->nid;
197 __entry->flags = flags;
198 __entry->la = map->m_la;
199 __entry->pa = map->m_pa;
200 __entry->llen = map->m_llen;
201 __entry->plen = map->m_plen;
202 __entry->mflags = map->m_flags;
203 __entry->ret = ret;
206 TP_printk("dev = (%d,%d), nid = %llu, flags %s "
207 "la %llu pa %llu llen %llu plen %llu mflags %s ret %d",
208 show_dev_nid(__entry),
209 __entry->flags ? show_map_flags(__entry->flags) : "NULL",
210 __entry->la, __entry->pa, __entry->llen, __entry->plen,
211 show_mflags(__entry->mflags), __entry->ret)
214 TRACE_EVENT(erofs_destroy_inode,
215 TP_PROTO(struct inode *inode),
217 TP_ARGS(inode),
219 TP_STRUCT__entry(
220 __field( dev_t, dev )
221 __field( erofs_nid_t, nid )
224 TP_fast_assign(
225 __entry->dev = inode->i_sb->s_dev;
226 __entry->nid = EROFS_I(inode)->nid;
229 TP_printk("dev = (%d,%d), nid = %llu", show_dev_nid(__entry))
232 #endif /* _TRACE_EROFS_H */
234 /* This part must be outside protection */
235 #include <trace/define_trace.h>