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_RAW, "RAW" })
24 #define show_mflags(flags) __print_flags(flags, "", \
25 { EROFS_MAP_MAPPED, "M" }, \
26 { EROFS_MAP_META, "I" }, \
27 { EROFS_MAP_ZIPPED, "Z" })
29 TRACE_EVENT(erofs_lookup
,
31 TP_PROTO(struct inode
*dir
, struct dentry
*dentry
, unsigned int flags
),
33 TP_ARGS(dir
, dentry
, flags
),
37 __field(erofs_nid_t
, nid
)
38 __string(name
, dentry
->d_name
.name
)
39 __field(unsigned int, flags
)
43 __entry
->dev
= dir
->i_sb
->s_dev
;
44 __entry
->nid
= EROFS_I(dir
)->nid
;
45 __assign_str(name
, dentry
->d_name
.name
);
46 __entry
->flags
= flags
;
49 TP_printk("dev = (%d,%d), pnid = %llu, name:%s, flags:%x",
50 show_dev_nid(__entry
),
55 TRACE_EVENT(erofs_fill_inode
,
56 TP_PROTO(struct inode
*inode
, int isdir
),
57 TP_ARGS(inode
, isdir
),
61 __field(erofs_nid_t
, nid
)
62 __field(erofs_blk_t
, blkaddr
)
63 __field(unsigned int, ofs
)
68 __entry
->dev
= inode
->i_sb
->s_dev
;
69 __entry
->nid
= EROFS_I(inode
)->nid
;
70 __entry
->blkaddr
= erofs_blknr(iloc(EROFS_I_SB(inode
), __entry
->nid
));
71 __entry
->ofs
= erofs_blkoff(iloc(EROFS_I_SB(inode
), __entry
->nid
));
72 __entry
->isdir
= isdir
;
75 TP_printk("dev = (%d,%d), nid = %llu, blkaddr %u ofs %u, isdir %d",
76 show_dev_nid(__entry
),
77 __entry
->blkaddr
, __entry
->ofs
,
81 TRACE_EVENT(erofs_readpage
,
83 TP_PROTO(struct page
*page
, bool raw
),
89 __field(erofs_nid_t
, nid
)
91 __field(pgoff_t
, index
)
92 __field(int, uptodate
)
97 __entry
->dev
= page
->mapping
->host
->i_sb
->s_dev
;
98 __entry
->nid
= EROFS_I(page
->mapping
->host
)->nid
;
99 __entry
->dir
= S_ISDIR(page
->mapping
->host
->i_mode
);
100 __entry
->index
= page
->index
;
101 __entry
->uptodate
= PageUptodate(page
);
105 TP_printk("dev = (%d,%d), nid = %llu, %s, index = %lu, uptodate = %d "
107 show_dev_nid(__entry
),
108 show_file_type(__entry
->dir
),
109 (unsigned long)__entry
->index
,
114 TRACE_EVENT(erofs_readpages
,
116 TP_PROTO(struct inode
*inode
, pgoff_t start
, unsigned int nrpage
,
119 TP_ARGS(inode
, start
, nrpage
, raw
),
123 __field(erofs_nid_t
, nid
)
124 __field(pgoff_t
, start
)
125 __field(unsigned int, nrpage
)
130 __entry
->dev
= inode
->i_sb
->s_dev
;
131 __entry
->nid
= EROFS_I(inode
)->nid
;
132 __entry
->start
= start
;
133 __entry
->nrpage
= nrpage
;
137 TP_printk("dev = (%d,%d), nid = %llu, start = %lu nrpage = %u raw = %d",
138 show_dev_nid(__entry
),
139 (unsigned long)__entry
->start
,
144 DECLARE_EVENT_CLASS(erofs__map_blocks_enter
,
145 TP_PROTO(struct inode
*inode
, struct erofs_map_blocks
*map
,
148 TP_ARGS(inode
, map
, flags
),
151 __field( dev_t
, dev
)
152 __field( erofs_nid_t
, nid
)
153 __field( erofs_off_t
, la
)
155 __field( unsigned int, flags
)
159 __entry
->dev
= inode
->i_sb
->s_dev
;
160 __entry
->nid
= EROFS_I(inode
)->nid
;
161 __entry
->la
= map
->m_la
;
162 __entry
->llen
= map
->m_llen
;
163 __entry
->flags
= flags
;
166 TP_printk("dev = (%d,%d), nid = %llu, la %llu llen %llu flags %s",
167 show_dev_nid(__entry
),
168 __entry
->la
, __entry
->llen
,
169 __entry
->flags
? show_map_flags(__entry
->flags
) : "NULL")
172 DEFINE_EVENT(erofs__map_blocks_enter
, erofs_map_blocks_flatmode_enter
,
173 TP_PROTO(struct inode
*inode
, struct erofs_map_blocks
*map
,
176 TP_ARGS(inode
, map
, flags
)
179 DEFINE_EVENT(erofs__map_blocks_enter
, z_erofs_map_blocks_iter_enter
,
180 TP_PROTO(struct inode
*inode
, struct erofs_map_blocks
*map
,
183 TP_ARGS(inode
, map
, flags
)
186 DECLARE_EVENT_CLASS(erofs__map_blocks_exit
,
187 TP_PROTO(struct inode
*inode
, struct erofs_map_blocks
*map
,
188 unsigned int flags
, int ret
),
190 TP_ARGS(inode
, map
, flags
, ret
),
193 __field( dev_t
, dev
)
194 __field( erofs_nid_t
, nid
)
195 __field( unsigned int, flags
)
196 __field( erofs_off_t
, la
)
197 __field( erofs_off_t
, pa
)
200 __field( unsigned int, mflags
)
205 __entry
->dev
= inode
->i_sb
->s_dev
;
206 __entry
->nid
= EROFS_I(inode
)->nid
;
207 __entry
->flags
= flags
;
208 __entry
->la
= map
->m_la
;
209 __entry
->pa
= map
->m_pa
;
210 __entry
->llen
= map
->m_llen
;
211 __entry
->plen
= map
->m_plen
;
212 __entry
->mflags
= map
->m_flags
;
216 TP_printk("dev = (%d,%d), nid = %llu, flags %s "
217 "la %llu pa %llu llen %llu plen %llu mflags %s ret %d",
218 show_dev_nid(__entry
),
219 __entry
->flags
? show_map_flags(__entry
->flags
) : "NULL",
220 __entry
->la
, __entry
->pa
, __entry
->llen
, __entry
->plen
,
221 show_mflags(__entry
->mflags
), __entry
->ret
)
224 DEFINE_EVENT(erofs__map_blocks_exit
, erofs_map_blocks_flatmode_exit
,
225 TP_PROTO(struct inode
*inode
, struct erofs_map_blocks
*map
,
226 unsigned flags
, int ret
),
228 TP_ARGS(inode
, map
, flags
, ret
)
231 DEFINE_EVENT(erofs__map_blocks_exit
, z_erofs_map_blocks_iter_exit
,
232 TP_PROTO(struct inode
*inode
, struct erofs_map_blocks
*map
,
233 unsigned int flags
, int ret
),
235 TP_ARGS(inode
, map
, flags
, ret
)
238 TRACE_EVENT(erofs_destroy_inode
,
239 TP_PROTO(struct inode
*inode
),
244 __field( dev_t
, dev
)
245 __field( erofs_nid_t
, nid
)
249 __entry
->dev
= inode
->i_sb
->s_dev
;
250 __entry
->nid
= EROFS_I(inode
)->nid
;
253 TP_printk("dev = (%d,%d), nid = %llu", show_dev_nid(__entry
))
256 #endif /* _TRACE_EROFS_H */
258 /* This part must be outside protection */
259 #include <trace/define_trace.h>