1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #define TRACE_SYSTEM erofs
5 #if !defined(_TRACE_EROFS_H) || defined(TRACE_HEADER_MULTI_READ)
8 #include <linux/tracepoint.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, \
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
),
42 __field(erofs_nid_t
, nid
)
43 __string(name
, dentry
->d_name
.name
)
44 __field(unsigned int, flags
)
48 __entry
->dev
= dir
->i_sb
->s_dev
;
49 __entry
->nid
= EROFS_I(dir
)->nid
;
51 __entry
->flags
= flags
;
54 TP_printk("dev = (%d,%d), pnid = %llu, name:%s, flags:%x",
55 show_dev_nid(__entry
),
60 TRACE_EVENT(erofs_fill_inode
,
61 TP_PROTO(struct inode
*inode
),
66 __field(erofs_nid_t
, nid
)
67 __field(erofs_blk_t
, blkaddr
)
68 __field(unsigned int, ofs
)
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
),
91 __field(erofs_nid_t
, nid
)
93 __field(pgoff_t
, index
)
94 __field(int, uptodate
)
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
);
107 TP_printk("dev = (%d,%d), nid = %llu, %s, index = %lu, uptodate = %d "
109 show_dev_nid(__entry
),
110 show_file_type(__entry
->dir
),
111 (unsigned long)__entry
->index
,
116 TRACE_EVENT(erofs_readpages
,
118 TP_PROTO(struct inode
*inode
, pgoff_t start
, unsigned int nrpage
,
121 TP_ARGS(inode
, start
, nrpage
, raw
),
125 __field(erofs_nid_t
, nid
)
126 __field(pgoff_t
, start
)
127 __field(unsigned int, nrpage
)
132 __entry
->dev
= inode
->i_sb
->s_dev
;
133 __entry
->nid
= EROFS_I(inode
)->nid
;
134 __entry
->start
= start
;
135 __entry
->nrpage
= nrpage
;
139 TP_printk("dev = (%d,%d), nid = %llu, start = %lu nrpage = %u raw = %d",
140 show_dev_nid(__entry
),
141 (unsigned long)__entry
->start
,
146 TRACE_EVENT(erofs_map_blocks_enter
,
148 TP_PROTO(struct inode
*inode
, struct erofs_map_blocks
*map
,
151 TP_ARGS(inode
, map
, flags
),
154 __field( dev_t
, dev
)
155 __field( erofs_nid_t
, nid
)
156 __field( erofs_off_t
, la
)
158 __field( unsigned int, flags
)
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
),
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
)
190 __field( unsigned int, mflags
)
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
;
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
),
220 __field( dev_t
, dev
)
221 __field( erofs_nid_t
, nid
)
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>