blob: f8f1e85ff1300a444ce538d68d10a3c7cfa15a58 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Namjae Jeona2a4a7e2013-04-20 01:28:40 +09002#undef TRACE_SYSTEM
3#define TRACE_SYSTEM f2fs
4
5#if !defined(_TRACE_F2FS_H) || defined(TRACE_HEADER_MULTI_READ)
6#define _TRACE_F2FS_H
7
8#include <linux/tracepoint.h>
9
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -080010#define show_dev(dev) MAJOR(dev), MINOR(dev)
11#define show_dev_ino(entry) show_dev(entry->dev), (unsigned long)entry->ino
Namjae Jeon6ec178d2013-04-23 17:51:43 +090012
Steven Rostedt (Red Hat)5511b9a2015-03-27 16:18:07 -040013TRACE_DEFINE_ENUM(NODE);
14TRACE_DEFINE_ENUM(DATA);
15TRACE_DEFINE_ENUM(META);
16TRACE_DEFINE_ENUM(META_FLUSH);
Jaegeuk Kim5d799882015-04-22 16:07:38 -070017TRACE_DEFINE_ENUM(INMEM);
18TRACE_DEFINE_ENUM(INMEM_DROP);
Jaegeuk Kim8c242db2017-03-17 09:55:52 +080019TRACE_DEFINE_ENUM(INMEM_INVALIDATE);
Chao Yua58f2442017-03-17 18:46:14 +080020TRACE_DEFINE_ENUM(INMEM_REVOKE);
Jaegeuk Kim5d799882015-04-22 16:07:38 -070021TRACE_DEFINE_ENUM(IPU);
22TRACE_DEFINE_ENUM(OPU);
Jaegeuk Kima912b542017-05-10 11:18:25 -070023TRACE_DEFINE_ENUM(HOT);
24TRACE_DEFINE_ENUM(WARM);
25TRACE_DEFINE_ENUM(COLD);
Steven Rostedt (Red Hat)5511b9a2015-03-27 16:18:07 -040026TRACE_DEFINE_ENUM(CURSEG_HOT_DATA);
27TRACE_DEFINE_ENUM(CURSEG_WARM_DATA);
28TRACE_DEFINE_ENUM(CURSEG_COLD_DATA);
29TRACE_DEFINE_ENUM(CURSEG_HOT_NODE);
30TRACE_DEFINE_ENUM(CURSEG_WARM_NODE);
31TRACE_DEFINE_ENUM(CURSEG_COLD_NODE);
32TRACE_DEFINE_ENUM(NO_CHECK_TYPE);
33TRACE_DEFINE_ENUM(GC_GREEDY);
34TRACE_DEFINE_ENUM(GC_CB);
35TRACE_DEFINE_ENUM(FG_GC);
36TRACE_DEFINE_ENUM(BG_GC);
37TRACE_DEFINE_ENUM(LFS);
38TRACE_DEFINE_ENUM(SSR);
39TRACE_DEFINE_ENUM(__REQ_RAHEAD);
Steven Rostedt (Red Hat)5511b9a2015-03-27 16:18:07 -040040TRACE_DEFINE_ENUM(__REQ_SYNC);
Christoph Hellwiga2b80962016-11-01 07:40:09 -060041TRACE_DEFINE_ENUM(__REQ_IDLE);
Mike Christie28a8f0d2016-06-05 14:32:25 -050042TRACE_DEFINE_ENUM(__REQ_PREFLUSH);
Steven Rostedt (Red Hat)5511b9a2015-03-27 16:18:07 -040043TRACE_DEFINE_ENUM(__REQ_FUA);
44TRACE_DEFINE_ENUM(__REQ_PRIO);
45TRACE_DEFINE_ENUM(__REQ_META);
46TRACE_DEFINE_ENUM(CP_UMOUNT);
47TRACE_DEFINE_ENUM(CP_FASTBOOT);
48TRACE_DEFINE_ENUM(CP_SYNC);
Jaegeuk Kim5d799882015-04-22 16:07:38 -070049TRACE_DEFINE_ENUM(CP_RECOVERY);
Steven Rostedt (Red Hat)5511b9a2015-03-27 16:18:07 -040050TRACE_DEFINE_ENUM(CP_DISCARD);
Chao Yu1f43e2a2017-04-28 13:56:08 +080051TRACE_DEFINE_ENUM(CP_TRIMMED);
Sahitya Tummalafad5fbc2020-01-03 08:49:28 +053052TRACE_DEFINE_ENUM(CP_PAUSE);
Jaegeuk Kimb4b10062020-03-31 11:43:07 -070053TRACE_DEFINE_ENUM(CP_RESIZE);
Steven Rostedt (Red Hat)5511b9a2015-03-27 16:18:07 -040054
Namjae Jeon6ec178d2013-04-23 17:51:43 +090055#define show_block_type(type) \
56 __print_symbolic(type, \
57 { NODE, "NODE" }, \
58 { DATA, "DATA" }, \
59 { META, "META" }, \
Jaegeuk Kim8ce67cb2015-03-17 17:58:08 -070060 { META_FLUSH, "META_FLUSH" }, \
61 { INMEM, "INMEM" }, \
62 { INMEM_DROP, "INMEM_DROP" }, \
Jaegeuk Kim8c242db2017-03-17 09:55:52 +080063 { INMEM_INVALIDATE, "INMEM_INVALIDATE" }, \
Chao Yu28bc1062016-02-06 14:40:34 +080064 { INMEM_REVOKE, "INMEM_REVOKE" }, \
Jaegeuk Kim8ce67cb2015-03-17 17:58:08 -070065 { IPU, "IN-PLACE" }, \
66 { OPU, "OUT-OF-PLACE" })
Namjae Jeon6ec178d2013-04-23 17:51:43 +090067
Jaegeuk Kima912b542017-05-10 11:18:25 -070068#define show_block_temp(temp) \
69 __print_symbolic(temp, \
70 { HOT, "HOT" }, \
71 { WARM, "WARM" }, \
72 { COLD, "COLD" })
73
Chao Yubaaabbb2017-05-04 09:35:43 +080074#define F2FS_OP_FLAGS (REQ_RAHEAD | REQ_SYNC | REQ_META | REQ_PRIO | \
75 REQ_PREFLUSH | REQ_FUA)
Jaegeuk Kimd621e6b2016-12-21 14:26:39 -080076#define F2FS_BIO_FLAG_MASK(t) (t & F2FS_OP_FLAGS)
Jaegeuk Kima709f4a2013-11-24 14:42:23 +090077
Jaegeuk Kimd621e6b2016-12-21 14:26:39 -080078#define show_bio_type(op,op_flags) show_bio_op(op), \
79 show_bio_op_flags(op_flags)
80
Chaitanya Kulkarni0ce35372019-06-20 10:59:19 -070081#define show_bio_op(op) blk_op_str(op)
Mike Christie04d328d2016-06-05 14:31:55 -050082
83#define show_bio_op_flags(flags) \
Chao Yubaaabbb2017-05-04 09:35:43 +080084 __print_flags(F2FS_BIO_FLAG_MASK(flags), "|", \
85 { REQ_RAHEAD, "R" }, \
86 { REQ_SYNC, "S" }, \
87 { REQ_META, "M" }, \
88 { REQ_PRIO, "P" }, \
89 { REQ_PREFLUSH, "PF" }, \
90 { REQ_FUA, "FUA" })
Jaegeuk Kima709f4a2013-11-24 14:42:23 +090091
Namjae Jeon8e46b3e2013-04-23 16:42:53 +090092#define show_data_type(type) \
93 __print_symbolic(type, \
94 { CURSEG_HOT_DATA, "Hot DATA" }, \
95 { CURSEG_WARM_DATA, "Warm DATA" }, \
96 { CURSEG_COLD_DATA, "Cold DATA" }, \
97 { CURSEG_HOT_NODE, "Hot NODE" }, \
98 { CURSEG_WARM_NODE, "Warm NODE" }, \
99 { CURSEG_COLD_NODE, "Cold NODE" }, \
100 { NO_CHECK_TYPE, "No TYPE" })
101
Jaegeuk Kim26c6b882013-10-24 17:53:29 +0900102#define show_file_type(type) \
103 __print_symbolic(type, \
104 { 0, "FILE" }, \
105 { 1, "DIR" })
106
Namjae Jeon8e46b3e2013-04-23 16:42:53 +0900107#define show_gc_type(type) \
108 __print_symbolic(type, \
109 { FG_GC, "Foreground GC" }, \
110 { BG_GC, "Background GC" })
111
112#define show_alloc_mode(type) \
113 __print_symbolic(type, \
Chao Yu093749e2020-08-04 21:14:49 +0800114 { LFS, "LFS-mode" }, \
115 { SSR, "SSR-mode" }, \
116 { AT_SSR, "AT_SSR-mode" })
Namjae Jeon8e46b3e2013-04-23 16:42:53 +0900117
118#define show_victim_policy(type) \
119 __print_symbolic(type, \
120 { GC_GREEDY, "Greedy" }, \
Chao Yu093749e2020-08-04 21:14:49 +0800121 { GC_CB, "Cost-Benefit" }, \
122 { GC_AT, "Age-threshold" })
Namjae Jeon8e46b3e2013-04-23 16:42:53 +0900123
Jaegeuk Kim75ab4cb2014-09-20 21:57:51 -0700124#define show_cpreason(type) \
Chao Yubaaabbb2017-05-04 09:35:43 +0800125 __print_flags(type, "|", \
Jaegeuk Kim75ab4cb2014-09-20 21:57:51 -0700126 { CP_UMOUNT, "Umount" }, \
Jaegeuk Kim119ee912015-01-29 11:45:33 -0800127 { CP_FASTBOOT, "Fastboot" }, \
Jaegeuk Kim4b2fecc2014-09-20 22:06:39 -0700128 { CP_SYNC, "Sync" }, \
Jaegeuk Kim10027552015-04-09 17:03:53 -0700129 { CP_RECOVERY, "Recovery" }, \
Chao Yu1f43e2a2017-04-28 13:56:08 +0800130 { CP_DISCARD, "Discard" }, \
Sahitya Tummalafad5fbc2020-01-03 08:49:28 +0530131 { CP_PAUSE, "Pause" }, \
Jaegeuk Kimb4b10062020-03-31 11:43:07 -0700132 { CP_TRIMMED, "Trimmed" }, \
133 { CP_RESIZE, "Resize" })
Jaegeuk Kim75ab4cb2014-09-20 21:57:51 -0700134
Chao Yua5fd5052017-11-06 22:51:45 +0800135#define show_fsync_cpreason(type) \
136 __print_symbolic(type, \
137 { CP_NO_NEEDED, "no needed" }, \
138 { CP_NON_REGULAR, "non regular" }, \
Chao Yu32c0fec2020-09-03 10:15:15 +0800139 { CP_COMPRESSED, "compressed" }, \
Chao Yua5fd5052017-11-06 22:51:45 +0800140 { CP_HARDLINK, "hardlink" }, \
141 { CP_SB_NEED_CP, "sb needs cp" }, \
142 { CP_WRONG_PINO, "wrong pino" }, \
143 { CP_NO_SPC_ROLL, "no space roll forward" }, \
144 { CP_NODE_NEED_CP, "node needs cp" }, \
145 { CP_FASTBOOT_MODE, "fastboot mode" }, \
Jaegeuk Kim0a007b972017-12-28 08:09:44 -0800146 { CP_SPEC_LOG_NUM, "log type is 2" }, \
147 { CP_RECOVER_DIR, "dir needs recovery" })
Chao Yua5fd5052017-11-06 22:51:45 +0800148
Chao Yu559e87c2019-02-26 19:01:15 +0800149#define show_shutdown_mode(type) \
150 __print_symbolic(type, \
151 { F2FS_GOING_DOWN_FULLSYNC, "full sync" }, \
152 { F2FS_GOING_DOWN_METASYNC, "meta sync" }, \
153 { F2FS_GOING_DOWN_NOSYNC, "no sync" }, \
154 { F2FS_GOING_DOWN_METAFLUSH, "meta flush" }, \
155 { F2FS_GOING_DOWN_NEED_FSCK, "need fsck" })
156
Chao Yu4c8ff702019-11-01 18:07:14 +0800157#define show_compress_algorithm(type) \
158 __print_symbolic(type, \
159 { COMPRESS_LZO, "LZO" }, \
Chao Yu50cfa662020-03-03 17:46:02 +0800160 { COMPRESS_LZ4, "LZ4" }, \
Chao Yu6d92b202020-04-08 19:56:32 +0800161 { COMPRESS_ZSTD, "ZSTD" }, \
162 { COMPRESS_LZORLE, "LZO-RLE" })
Chao Yu4c8ff702019-11-01 18:07:14 +0800163
Zhikang Zhang539cd352019-01-03 20:06:38 +0800164struct f2fs_sb_info;
165struct f2fs_io_info;
166struct extent_info;
Namjae Jeon8e46b3e2013-04-23 16:42:53 +0900167struct victim_sel_policy;
Jaegeuk Kim003a3e12015-04-06 19:55:34 -0700168struct f2fs_map_blocks;
Namjae Jeon8e46b3e2013-04-23 16:42:53 +0900169
Namjae Jeona2a4a7e2013-04-20 01:28:40 +0900170DECLARE_EVENT_CLASS(f2fs__inode,
171
172 TP_PROTO(struct inode *inode),
173
174 TP_ARGS(inode),
175
176 TP_STRUCT__entry(
177 __field(dev_t, dev)
178 __field(ino_t, ino)
179 __field(ino_t, pino)
180 __field(umode_t, mode)
181 __field(loff_t, size)
182 __field(unsigned int, nlink)
183 __field(blkcnt_t, blocks)
184 __field(__u8, advise)
185 ),
186
187 TP_fast_assign(
188 __entry->dev = inode->i_sb->s_dev;
189 __entry->ino = inode->i_ino;
190 __entry->pino = F2FS_I(inode)->i_pino;
191 __entry->mode = inode->i_mode;
192 __entry->nlink = inode->i_nlink;
193 __entry->size = inode->i_size;
194 __entry->blocks = inode->i_blocks;
195 __entry->advise = F2FS_I(inode)->i_advise;
196 ),
197
198 TP_printk("dev = (%d,%d), ino = %lu, pino = %lu, i_mode = 0x%hx, "
199 "i_size = %lld, i_nlink = %u, i_blocks = %llu, i_advise = 0x%x",
200 show_dev_ino(__entry),
201 (unsigned long)__entry->pino,
202 __entry->mode,
203 __entry->size,
204 (unsigned int)__entry->nlink,
205 (unsigned long long)__entry->blocks,
206 (unsigned char)__entry->advise)
207);
208
209DECLARE_EVENT_CLASS(f2fs__inode_exit,
210
211 TP_PROTO(struct inode *inode, int ret),
212
213 TP_ARGS(inode, ret),
214
215 TP_STRUCT__entry(
216 __field(dev_t, dev)
217 __field(ino_t, ino)
218 __field(int, ret)
219 ),
220
221 TP_fast_assign(
222 __entry->dev = inode->i_sb->s_dev;
223 __entry->ino = inode->i_ino;
224 __entry->ret = ret;
225 ),
226
227 TP_printk("dev = (%d,%d), ino = %lu, ret = %d",
228 show_dev_ino(__entry),
229 __entry->ret)
230);
231
232DEFINE_EVENT(f2fs__inode, f2fs_sync_file_enter,
233
234 TP_PROTO(struct inode *inode),
235
236 TP_ARGS(inode)
237);
238
239TRACE_EVENT(f2fs_sync_file_exit,
240
Chao Yua5fd5052017-11-06 22:51:45 +0800241 TP_PROTO(struct inode *inode, int cp_reason, int datasync, int ret),
Namjae Jeona2a4a7e2013-04-20 01:28:40 +0900242
Chao Yua5fd5052017-11-06 22:51:45 +0800243 TP_ARGS(inode, cp_reason, datasync, ret),
Namjae Jeona2a4a7e2013-04-20 01:28:40 +0900244
245 TP_STRUCT__entry(
246 __field(dev_t, dev)
247 __field(ino_t, ino)
Chao Yua5fd5052017-11-06 22:51:45 +0800248 __field(int, cp_reason)
Namjae Jeona2a4a7e2013-04-20 01:28:40 +0900249 __field(int, datasync)
250 __field(int, ret)
251 ),
252
253 TP_fast_assign(
254 __entry->dev = inode->i_sb->s_dev;
255 __entry->ino = inode->i_ino;
Chao Yua5fd5052017-11-06 22:51:45 +0800256 __entry->cp_reason = cp_reason;
Namjae Jeona2a4a7e2013-04-20 01:28:40 +0900257 __entry->datasync = datasync;
258 __entry->ret = ret;
259 ),
260
Chao Yua5fd5052017-11-06 22:51:45 +0800261 TP_printk("dev = (%d,%d), ino = %lu, cp_reason: %s, "
Namjae Jeona2a4a7e2013-04-20 01:28:40 +0900262 "datasync = %d, ret = %d",
263 show_dev_ino(__entry),
Chao Yua5fd5052017-11-06 22:51:45 +0800264 show_fsync_cpreason(__entry->cp_reason),
Namjae Jeona2a4a7e2013-04-20 01:28:40 +0900265 __entry->datasync,
266 __entry->ret)
267);
268
269TRACE_EVENT(f2fs_sync_fs,
270
271 TP_PROTO(struct super_block *sb, int wait),
272
273 TP_ARGS(sb, wait),
274
275 TP_STRUCT__entry(
276 __field(dev_t, dev)
Jaegeuk Kim29e70432015-02-10 16:23:12 -0800277 __field(int, dirty)
Namjae Jeona2a4a7e2013-04-20 01:28:40 +0900278 __field(int, wait)
279 ),
280
281 TP_fast_assign(
282 __entry->dev = sb->s_dev;
Chao Yucaf00472015-01-28 17:48:42 +0800283 __entry->dirty = is_sbi_flag_set(F2FS_SB(sb), SBI_IS_DIRTY);
Namjae Jeona2a4a7e2013-04-20 01:28:40 +0900284 __entry->wait = wait;
285 ),
286
287 TP_printk("dev = (%d,%d), superblock is %s, wait = %d",
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -0800288 show_dev(__entry->dev),
Namjae Jeona2a4a7e2013-04-20 01:28:40 +0900289 __entry->dirty ? "dirty" : "not dirty",
290 __entry->wait)
291);
292
293DEFINE_EVENT(f2fs__inode, f2fs_iget,
294
295 TP_PROTO(struct inode *inode),
296
297 TP_ARGS(inode)
298);
299
300DEFINE_EVENT(f2fs__inode_exit, f2fs_iget_exit,
301
302 TP_PROTO(struct inode *inode, int ret),
303
304 TP_ARGS(inode, ret)
305);
306
307DEFINE_EVENT(f2fs__inode, f2fs_evict_inode,
308
309 TP_PROTO(struct inode *inode),
310
311 TP_ARGS(inode)
312);
313
Jaegeuk Kimd70b4f52013-04-25 13:24:33 +0900314DEFINE_EVENT(f2fs__inode_exit, f2fs_new_inode,
315
316 TP_PROTO(struct inode *inode, int ret),
317
318 TP_ARGS(inode, ret)
319);
320
Namjae Jeona2a4a7e2013-04-20 01:28:40 +0900321TRACE_EVENT(f2fs_unlink_enter,
322
323 TP_PROTO(struct inode *dir, struct dentry *dentry),
324
325 TP_ARGS(dir, dentry),
326
327 TP_STRUCT__entry(
328 __field(dev_t, dev)
329 __field(ino_t, ino)
330 __field(loff_t, size)
331 __field(blkcnt_t, blocks)
332 __field(const char *, name)
333 ),
334
335 TP_fast_assign(
336 __entry->dev = dir->i_sb->s_dev;
337 __entry->ino = dir->i_ino;
338 __entry->size = dir->i_size;
339 __entry->blocks = dir->i_blocks;
340 __entry->name = dentry->d_name.name;
341 ),
342
343 TP_printk("dev = (%d,%d), dir ino = %lu, i_size = %lld, "
344 "i_blocks = %llu, name = %s",
345 show_dev_ino(__entry),
346 __entry->size,
347 (unsigned long long)__entry->blocks,
348 __entry->name)
349);
350
351DEFINE_EVENT(f2fs__inode_exit, f2fs_unlink_exit,
352
353 TP_PROTO(struct inode *inode, int ret),
354
355 TP_ARGS(inode, ret)
356);
Namjae Jeon51dd6242013-04-20 01:28:52 +0900357
Hou Pengyangb8d96a32017-02-27 13:02:58 +0000358DEFINE_EVENT(f2fs__inode_exit, f2fs_drop_inode,
359
360 TP_PROTO(struct inode *inode, int ret),
361
362 TP_ARGS(inode, ret)
363);
364
Namjae Jeon51dd6242013-04-20 01:28:52 +0900365DEFINE_EVENT(f2fs__inode, f2fs_truncate,
366
367 TP_PROTO(struct inode *inode),
368
369 TP_ARGS(inode)
370);
371
372TRACE_EVENT(f2fs_truncate_data_blocks_range,
373
374 TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs, int free),
375
376 TP_ARGS(inode, nid, ofs, free),
377
378 TP_STRUCT__entry(
379 __field(dev_t, dev)
380 __field(ino_t, ino)
381 __field(nid_t, nid)
382 __field(unsigned int, ofs)
383 __field(int, free)
384 ),
385
386 TP_fast_assign(
387 __entry->dev = inode->i_sb->s_dev;
388 __entry->ino = inode->i_ino;
389 __entry->nid = nid;
390 __entry->ofs = ofs;
391 __entry->free = free;
392 ),
393
394 TP_printk("dev = (%d,%d), ino = %lu, nid = %u, offset = %u, freed = %d",
395 show_dev_ino(__entry),
396 (unsigned int)__entry->nid,
397 __entry->ofs,
398 __entry->free)
399);
400
401DECLARE_EVENT_CLASS(f2fs__truncate_op,
402
403 TP_PROTO(struct inode *inode, u64 from),
404
405 TP_ARGS(inode, from),
406
407 TP_STRUCT__entry(
408 __field(dev_t, dev)
409 __field(ino_t, ino)
410 __field(loff_t, size)
411 __field(blkcnt_t, blocks)
412 __field(u64, from)
413 ),
414
415 TP_fast_assign(
416 __entry->dev = inode->i_sb->s_dev;
417 __entry->ino = inode->i_ino;
418 __entry->size = inode->i_size;
419 __entry->blocks = inode->i_blocks;
420 __entry->from = from;
421 ),
422
423 TP_printk("dev = (%d,%d), ino = %lu, i_size = %lld, i_blocks = %llu, "
424 "start file offset = %llu",
425 show_dev_ino(__entry),
426 __entry->size,
427 (unsigned long long)__entry->blocks,
428 (unsigned long long)__entry->from)
429);
430
431DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_blocks_enter,
432
433 TP_PROTO(struct inode *inode, u64 from),
434
435 TP_ARGS(inode, from)
436);
437
438DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_blocks_exit,
439
440 TP_PROTO(struct inode *inode, int ret),
441
442 TP_ARGS(inode, ret)
443);
444
445DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_inode_blocks_enter,
446
447 TP_PROTO(struct inode *inode, u64 from),
448
449 TP_ARGS(inode, from)
450);
451
452DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_inode_blocks_exit,
453
454 TP_PROTO(struct inode *inode, int ret),
455
456 TP_ARGS(inode, ret)
457);
458
459DECLARE_EVENT_CLASS(f2fs__truncate_node,
460
461 TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
462
463 TP_ARGS(inode, nid, blk_addr),
464
465 TP_STRUCT__entry(
466 __field(dev_t, dev)
467 __field(ino_t, ino)
468 __field(nid_t, nid)
469 __field(block_t, blk_addr)
470 ),
471
472 TP_fast_assign(
473 __entry->dev = inode->i_sb->s_dev;
474 __entry->ino = inode->i_ino;
475 __entry->nid = nid;
476 __entry->blk_addr = blk_addr;
477 ),
478
479 TP_printk("dev = (%d,%d), ino = %lu, nid = %u, block_address = 0x%llx",
480 show_dev_ino(__entry),
481 (unsigned int)__entry->nid,
482 (unsigned long long)__entry->blk_addr)
483);
484
485DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_nodes_enter,
486
487 TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
488
489 TP_ARGS(inode, nid, blk_addr)
490);
491
492DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_nodes_exit,
493
494 TP_PROTO(struct inode *inode, int ret),
495
496 TP_ARGS(inode, ret)
497);
498
499DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_node,
500
501 TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
502
503 TP_ARGS(inode, nid, blk_addr)
504);
505
506TRACE_EVENT(f2fs_truncate_partial_nodes,
507
Alexei Starovoitovc1055472018-03-28 12:05:32 -0700508 TP_PROTO(struct inode *inode, nid_t *nid, int depth, int err),
Namjae Jeon51dd6242013-04-20 01:28:52 +0900509
510 TP_ARGS(inode, nid, depth, err),
511
512 TP_STRUCT__entry(
513 __field(dev_t, dev)
514 __field(ino_t, ino)
515 __field(nid_t, nid[3])
516 __field(int, depth)
517 __field(int, err)
518 ),
519
520 TP_fast_assign(
521 __entry->dev = inode->i_sb->s_dev;
522 __entry->ino = inode->i_ino;
523 __entry->nid[0] = nid[0];
524 __entry->nid[1] = nid[1];
525 __entry->nid[2] = nid[2];
526 __entry->depth = depth;
527 __entry->err = err;
528 ),
529
530 TP_printk("dev = (%d,%d), ino = %lu, "
531 "nid[0] = %u, nid[1] = %u, nid[2] = %u, depth = %d, err = %d",
532 show_dev_ino(__entry),
533 (unsigned int)__entry->nid[0],
534 (unsigned int)__entry->nid[1],
535 (unsigned int)__entry->nid[2],
536 __entry->depth,
537 __entry->err)
538);
539
Chao Yu126ce722019-04-02 18:52:22 +0800540TRACE_EVENT(f2fs_file_write_iter,
541
542 TP_PROTO(struct inode *inode, unsigned long offset,
543 unsigned long length, int ret),
544
545 TP_ARGS(inode, offset, length, ret),
546
547 TP_STRUCT__entry(
548 __field(dev_t, dev)
549 __field(ino_t, ino)
550 __field(unsigned long, offset)
551 __field(unsigned long, length)
552 __field(int, ret)
553 ),
554
555 TP_fast_assign(
556 __entry->dev = inode->i_sb->s_dev;
557 __entry->ino = inode->i_ino;
558 __entry->offset = offset;
559 __entry->length = length;
560 __entry->ret = ret;
561 ),
562
563 TP_printk("dev = (%d,%d), ino = %lu, "
564 "offset = %lu, length = %lu, written(err) = %d",
565 show_dev_ino(__entry),
566 __entry->offset,
567 __entry->length,
568 __entry->ret)
569);
570
Jaegeuk Kim003a3e12015-04-06 19:55:34 -0700571TRACE_EVENT(f2fs_map_blocks,
572 TP_PROTO(struct inode *inode, struct f2fs_map_blocks *map, int ret),
Namjae Jeon848753a2013-04-23 16:38:02 +0900573
Jaegeuk Kim003a3e12015-04-06 19:55:34 -0700574 TP_ARGS(inode, map, ret),
Namjae Jeon848753a2013-04-23 16:38:02 +0900575
576 TP_STRUCT__entry(
577 __field(dev_t, dev)
578 __field(ino_t, ino)
Jaegeuk Kim003a3e12015-04-06 19:55:34 -0700579 __field(block_t, m_lblk)
580 __field(block_t, m_pblk)
581 __field(unsigned int, m_len)
Chao Yu76630f22019-02-26 19:01:16 +0800582 __field(unsigned int, m_flags)
583 __field(int, m_seg_type)
584 __field(bool, m_may_create)
Namjae Jeon848753a2013-04-23 16:38:02 +0900585 __field(int, ret)
586 ),
587
588 TP_fast_assign(
589 __entry->dev = inode->i_sb->s_dev;
590 __entry->ino = inode->i_ino;
Jaegeuk Kim003a3e12015-04-06 19:55:34 -0700591 __entry->m_lblk = map->m_lblk;
592 __entry->m_pblk = map->m_pblk;
593 __entry->m_len = map->m_len;
Chao Yu76630f22019-02-26 19:01:16 +0800594 __entry->m_flags = map->m_flags;
595 __entry->m_seg_type = map->m_seg_type;
596 __entry->m_may_create = map->m_may_create;
Namjae Jeon848753a2013-04-23 16:38:02 +0900597 __entry->ret = ret;
598 ),
599
600 TP_printk("dev = (%d,%d), ino = %lu, file offset = %llu, "
Chao Yu76630f22019-02-26 19:01:16 +0800601 "start blkaddr = 0x%llx, len = 0x%llx, flags = %u,"
602 "seg_type = %d, may_create = %d, err = %d",
Namjae Jeon848753a2013-04-23 16:38:02 +0900603 show_dev_ino(__entry),
Jaegeuk Kim003a3e12015-04-06 19:55:34 -0700604 (unsigned long long)__entry->m_lblk,
605 (unsigned long long)__entry->m_pblk,
606 (unsigned long long)__entry->m_len,
Chao Yu76630f22019-02-26 19:01:16 +0800607 __entry->m_flags,
608 __entry->m_seg_type,
609 __entry->m_may_create,
Namjae Jeon848753a2013-04-23 16:38:02 +0900610 __entry->ret)
611);
612
Jaegeuk Kim5c267432015-10-05 11:32:34 -0700613TRACE_EVENT(f2fs_background_gc,
614
Chao Yub8c502b2017-08-07 23:12:46 +0800615 TP_PROTO(struct super_block *sb, unsigned int wait_ms,
Jaegeuk Kim5c267432015-10-05 11:32:34 -0700616 unsigned int prefree, unsigned int free),
617
618 TP_ARGS(sb, wait_ms, prefree, free),
619
620 TP_STRUCT__entry(
621 __field(dev_t, dev)
Chao Yub8c502b2017-08-07 23:12:46 +0800622 __field(unsigned int, wait_ms)
Jaegeuk Kim5c267432015-10-05 11:32:34 -0700623 __field(unsigned int, prefree)
624 __field(unsigned int, free)
625 ),
626
627 TP_fast_assign(
628 __entry->dev = sb->s_dev;
629 __entry->wait_ms = wait_ms;
630 __entry->prefree = prefree;
631 __entry->free = free;
632 ),
633
Chao Yub8c502b2017-08-07 23:12:46 +0800634 TP_printk("dev = (%d,%d), wait_ms = %u, prefree = %u, free = %u",
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -0800635 show_dev(__entry->dev),
Jaegeuk Kim5c267432015-10-05 11:32:34 -0700636 __entry->wait_ms,
637 __entry->prefree,
638 __entry->free)
639);
640
Chao Yuc56f16d2017-08-11 18:00:15 +0800641TRACE_EVENT(f2fs_gc_begin,
642
643 TP_PROTO(struct super_block *sb, bool sync, bool background,
644 long long dirty_nodes, long long dirty_dents,
645 long long dirty_imeta, unsigned int free_sec,
646 unsigned int free_seg, int reserved_seg,
647 unsigned int prefree_seg),
648
649 TP_ARGS(sb, sync, background, dirty_nodes, dirty_dents, dirty_imeta,
650 free_sec, free_seg, reserved_seg, prefree_seg),
651
652 TP_STRUCT__entry(
653 __field(dev_t, dev)
654 __field(bool, sync)
655 __field(bool, background)
656 __field(long long, dirty_nodes)
657 __field(long long, dirty_dents)
658 __field(long long, dirty_imeta)
659 __field(unsigned int, free_sec)
660 __field(unsigned int, free_seg)
661 __field(int, reserved_seg)
662 __field(unsigned int, prefree_seg)
663 ),
664
665 TP_fast_assign(
666 __entry->dev = sb->s_dev;
667 __entry->sync = sync;
668 __entry->background = background;
669 __entry->dirty_nodes = dirty_nodes;
670 __entry->dirty_dents = dirty_dents;
671 __entry->dirty_imeta = dirty_imeta;
672 __entry->free_sec = free_sec;
673 __entry->free_seg = free_seg;
674 __entry->reserved_seg = reserved_seg;
675 __entry->prefree_seg = prefree_seg;
676 ),
677
678 TP_printk("dev = (%d,%d), sync = %d, background = %d, nodes = %lld, "
679 "dents = %lld, imeta = %lld, free_sec:%u, free_seg:%u, "
680 "rsv_seg:%d, prefree_seg:%u",
681 show_dev(__entry->dev),
682 __entry->sync,
683 __entry->background,
684 __entry->dirty_nodes,
685 __entry->dirty_dents,
686 __entry->dirty_imeta,
687 __entry->free_sec,
688 __entry->free_seg,
689 __entry->reserved_seg,
690 __entry->prefree_seg)
691);
692
693TRACE_EVENT(f2fs_gc_end,
694
695 TP_PROTO(struct super_block *sb, int ret, int seg_freed,
696 int sec_freed, long long dirty_nodes,
697 long long dirty_dents, long long dirty_imeta,
698 unsigned int free_sec, unsigned int free_seg,
699 int reserved_seg, unsigned int prefree_seg),
700
701 TP_ARGS(sb, ret, seg_freed, sec_freed, dirty_nodes, dirty_dents,
702 dirty_imeta, free_sec, free_seg, reserved_seg, prefree_seg),
703
704 TP_STRUCT__entry(
705 __field(dev_t, dev)
706 __field(int, ret)
707 __field(int, seg_freed)
708 __field(int, sec_freed)
709 __field(long long, dirty_nodes)
710 __field(long long, dirty_dents)
711 __field(long long, dirty_imeta)
712 __field(unsigned int, free_sec)
713 __field(unsigned int, free_seg)
714 __field(int, reserved_seg)
715 __field(unsigned int, prefree_seg)
716 ),
717
718 TP_fast_assign(
719 __entry->dev = sb->s_dev;
720 __entry->ret = ret;
721 __entry->seg_freed = seg_freed;
722 __entry->sec_freed = sec_freed;
723 __entry->dirty_nodes = dirty_nodes;
724 __entry->dirty_dents = dirty_dents;
725 __entry->dirty_imeta = dirty_imeta;
726 __entry->free_sec = free_sec;
727 __entry->free_seg = free_seg;
728 __entry->reserved_seg = reserved_seg;
729 __entry->prefree_seg = prefree_seg;
730 ),
731
732 TP_printk("dev = (%d,%d), ret = %d, seg_freed = %d, sec_freed = %d, "
733 "nodes = %lld, dents = %lld, imeta = %lld, free_sec:%u, "
734 "free_seg:%u, rsv_seg:%d, prefree_seg:%u",
735 show_dev(__entry->dev),
736 __entry->ret,
737 __entry->seg_freed,
738 __entry->sec_freed,
739 __entry->dirty_nodes,
740 __entry->dirty_dents,
741 __entry->dirty_imeta,
742 __entry->free_sec,
743 __entry->free_seg,
744 __entry->reserved_seg,
745 __entry->prefree_seg)
746);
747
Namjae Jeon8e46b3e2013-04-23 16:42:53 +0900748TRACE_EVENT(f2fs_get_victim,
749
750 TP_PROTO(struct super_block *sb, int type, int gc_type,
751 struct victim_sel_policy *p, unsigned int pre_victim,
752 unsigned int prefree, unsigned int free),
753
754 TP_ARGS(sb, type, gc_type, p, pre_victim, prefree, free),
755
756 TP_STRUCT__entry(
757 __field(dev_t, dev)
758 __field(int, type)
759 __field(int, gc_type)
760 __field(int, alloc_mode)
761 __field(int, gc_mode)
762 __field(unsigned int, victim)
Jaegeuk Kim5012de22017-02-16 10:35:41 -0800763 __field(unsigned int, cost)
Namjae Jeon8e46b3e2013-04-23 16:42:53 +0900764 __field(unsigned int, ofs_unit)
765 __field(unsigned int, pre_victim)
766 __field(unsigned int, prefree)
767 __field(unsigned int, free)
768 ),
769
770 TP_fast_assign(
771 __entry->dev = sb->s_dev;
772 __entry->type = type;
773 __entry->gc_type = gc_type;
774 __entry->alloc_mode = p->alloc_mode;
775 __entry->gc_mode = p->gc_mode;
776 __entry->victim = p->min_segno;
Jaegeuk Kim5012de22017-02-16 10:35:41 -0800777 __entry->cost = p->min_cost;
Namjae Jeon8e46b3e2013-04-23 16:42:53 +0900778 __entry->ofs_unit = p->ofs_unit;
779 __entry->pre_victim = pre_victim;
780 __entry->prefree = prefree;
781 __entry->free = free;
782 ),
783
Jaegeuk Kim5012de22017-02-16 10:35:41 -0800784 TP_printk("dev = (%d,%d), type = %s, policy = (%s, %s, %s), "
785 "victim = %u, cost = %u, ofs_unit = %u, "
786 "pre_victim_secno = %d, prefree = %u, free = %u",
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -0800787 show_dev(__entry->dev),
Namjae Jeon8e46b3e2013-04-23 16:42:53 +0900788 show_data_type(__entry->type),
789 show_gc_type(__entry->gc_type),
790 show_alloc_mode(__entry->alloc_mode),
791 show_victim_policy(__entry->gc_mode),
792 __entry->victim,
Jaegeuk Kim5012de22017-02-16 10:35:41 -0800793 __entry->cost,
Namjae Jeon8e46b3e2013-04-23 16:42:53 +0900794 __entry->ofs_unit,
795 (int)__entry->pre_victim,
796 __entry->prefree,
797 __entry->free)
798);
799
Chao Yu0c5e36d2017-10-17 17:33:41 +0800800TRACE_EVENT(f2fs_lookup_start,
801
802 TP_PROTO(struct inode *dir, struct dentry *dentry, unsigned int flags),
803
804 TP_ARGS(dir, dentry, flags),
805
806 TP_STRUCT__entry(
807 __field(dev_t, dev)
808 __field(ino_t, ino)
809 __field(const char *, name)
810 __field(unsigned int, flags)
811 ),
812
813 TP_fast_assign(
814 __entry->dev = dir->i_sb->s_dev;
815 __entry->ino = dir->i_ino;
816 __entry->name = dentry->d_name.name;
817 __entry->flags = flags;
818 ),
819
820 TP_printk("dev = (%d,%d), pino = %lu, name:%s, flags:%u",
821 show_dev_ino(__entry),
822 __entry->name,
823 __entry->flags)
824);
825
826TRACE_EVENT(f2fs_lookup_end,
827
828 TP_PROTO(struct inode *dir, struct dentry *dentry, nid_t ino,
829 int err),
830
831 TP_ARGS(dir, dentry, ino, err),
832
833 TP_STRUCT__entry(
834 __field(dev_t, dev)
835 __field(ino_t, ino)
836 __field(const char *, name)
837 __field(nid_t, cino)
838 __field(int, err)
839 ),
840
841 TP_fast_assign(
842 __entry->dev = dir->i_sb->s_dev;
843 __entry->ino = dir->i_ino;
844 __entry->name = dentry->d_name.name;
845 __entry->cino = ino;
846 __entry->err = err;
847 ),
848
849 TP_printk("dev = (%d,%d), pino = %lu, name:%s, ino:%u, err:%d",
850 show_dev_ino(__entry),
851 __entry->name,
852 __entry->cino,
853 __entry->err)
854);
855
Chao Yue97a3c42017-10-13 18:01:33 +0800856TRACE_EVENT(f2fs_readdir,
857
858 TP_PROTO(struct inode *dir, loff_t start_pos, loff_t end_pos, int err),
859
860 TP_ARGS(dir, start_pos, end_pos, err),
861
862 TP_STRUCT__entry(
863 __field(dev_t, dev)
864 __field(ino_t, ino)
865 __field(loff_t, start)
866 __field(loff_t, end)
867 __field(int, err)
868 ),
869
870 TP_fast_assign(
871 __entry->dev = dir->i_sb->s_dev;
872 __entry->ino = dir->i_ino;
873 __entry->start = start_pos;
874 __entry->end = end_pos;
875 __entry->err = err;
876 ),
877
878 TP_printk("dev = (%d,%d), ino = %lu, start_pos:%llu, end_pos:%llu, err:%d",
879 show_dev_ino(__entry),
880 __entry->start,
881 __entry->end,
882 __entry->err)
883);
884
Namjae Jeonc01e2852013-04-23 17:00:52 +0900885TRACE_EVENT(f2fs_fallocate,
886
887 TP_PROTO(struct inode *inode, int mode,
888 loff_t offset, loff_t len, int ret),
889
890 TP_ARGS(inode, mode, offset, len, ret),
891
892 TP_STRUCT__entry(
893 __field(dev_t, dev)
894 __field(ino_t, ino)
895 __field(int, mode)
896 __field(loff_t, offset)
897 __field(loff_t, len)
898 __field(loff_t, size)
899 __field(blkcnt_t, blocks)
900 __field(int, ret)
901 ),
902
903 TP_fast_assign(
904 __entry->dev = inode->i_sb->s_dev;
905 __entry->ino = inode->i_ino;
906 __entry->mode = mode;
907 __entry->offset = offset;
908 __entry->len = len;
909 __entry->size = inode->i_size;
910 __entry->blocks = inode->i_blocks;
911 __entry->ret = ret;
912 ),
913
914 TP_printk("dev = (%d,%d), ino = %lu, mode = %x, offset = %lld, "
915 "len = %lld, i_size = %lld, i_blocks = %llu, ret = %d",
916 show_dev_ino(__entry),
917 __entry->mode,
918 (unsigned long long)__entry->offset,
919 (unsigned long long)__entry->len,
920 (unsigned long long)__entry->size,
921 (unsigned long long)__entry->blocks,
922 __entry->ret)
923);
924
Chao Yu70407fa2014-07-31 21:11:22 +0800925TRACE_EVENT(f2fs_direct_IO_enter,
926
927 TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw),
928
929 TP_ARGS(inode, offset, len, rw),
930
931 TP_STRUCT__entry(
932 __field(dev_t, dev)
933 __field(ino_t, ino)
934 __field(loff_t, pos)
935 __field(unsigned long, len)
936 __field(int, rw)
937 ),
938
939 TP_fast_assign(
940 __entry->dev = inode->i_sb->s_dev;
941 __entry->ino = inode->i_ino;
942 __entry->pos = offset;
943 __entry->len = len;
944 __entry->rw = rw;
945 ),
946
947 TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu rw = %d",
948 show_dev_ino(__entry),
949 __entry->pos,
950 __entry->len,
951 __entry->rw)
952);
953
954TRACE_EVENT(f2fs_direct_IO_exit,
955
956 TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
957 int rw, int ret),
958
959 TP_ARGS(inode, offset, len, rw, ret),
960
961 TP_STRUCT__entry(
962 __field(dev_t, dev)
963 __field(ino_t, ino)
964 __field(loff_t, pos)
965 __field(unsigned long, len)
966 __field(int, rw)
967 __field(int, ret)
968 ),
969
970 TP_fast_assign(
971 __entry->dev = inode->i_sb->s_dev;
972 __entry->ino = inode->i_ino;
973 __entry->pos = offset;
974 __entry->len = len;
975 __entry->rw = rw;
976 __entry->ret = ret;
977 ),
978
979 TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu "
980 "rw = %d ret = %d",
981 show_dev_ino(__entry),
982 __entry->pos,
983 __entry->len,
984 __entry->rw,
985 __entry->ret)
986);
987
Chao Yu46008c62016-05-09 19:56:30 +0800988TRACE_EVENT(f2fs_reserve_new_blocks,
Namjae Jeonc01e2852013-04-23 17:00:52 +0900989
Chao Yu46008c62016-05-09 19:56:30 +0800990 TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs_in_node,
991 blkcnt_t count),
Namjae Jeonc01e2852013-04-23 17:00:52 +0900992
Chao Yu46008c62016-05-09 19:56:30 +0800993 TP_ARGS(inode, nid, ofs_in_node, count),
Namjae Jeonc01e2852013-04-23 17:00:52 +0900994
995 TP_STRUCT__entry(
996 __field(dev_t, dev)
997 __field(nid_t, nid)
998 __field(unsigned int, ofs_in_node)
Chao Yu46008c62016-05-09 19:56:30 +0800999 __field(blkcnt_t, count)
Namjae Jeonc01e2852013-04-23 17:00:52 +09001000 ),
1001
1002 TP_fast_assign(
1003 __entry->dev = inode->i_sb->s_dev;
1004 __entry->nid = nid;
1005 __entry->ofs_in_node = ofs_in_node;
Chao Yu46008c62016-05-09 19:56:30 +08001006 __entry->count = count;
Namjae Jeonc01e2852013-04-23 17:00:52 +09001007 ),
1008
Chao Yu46008c62016-05-09 19:56:30 +08001009 TP_printk("dev = (%d,%d), nid = %u, ofs_in_node = %u, count = %llu",
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001010 show_dev(__entry->dev),
Namjae Jeonc01e2852013-04-23 17:00:52 +09001011 (unsigned int)__entry->nid,
Chao Yu46008c62016-05-09 19:56:30 +08001012 __entry->ofs_in_node,
1013 (unsigned long long)__entry->count)
Namjae Jeonc01e2852013-04-23 17:00:52 +09001014);
1015
Chao Yu3e1c8f12014-12-23 16:35:21 +08001016DECLARE_EVENT_CLASS(f2fs__submit_page_bio,
1017
Chao Yu2ace38e2014-12-24 16:08:14 +08001018 TP_PROTO(struct page *page, struct f2fs_io_info *fio),
Chao Yu3e1c8f12014-12-23 16:35:21 +08001019
Chao Yu2ace38e2014-12-24 16:08:14 +08001020 TP_ARGS(page, fio),
Chao Yu3e1c8f12014-12-23 16:35:21 +08001021
1022 TP_STRUCT__entry(
1023 __field(dev_t, dev)
1024 __field(ino_t, ino)
1025 __field(pgoff_t, index)
Chao Yu7a9d7542016-02-22 18:36:38 +08001026 __field(block_t, old_blkaddr)
1027 __field(block_t, new_blkaddr)
Mike Christie04d328d2016-06-05 14:31:55 -05001028 __field(int, op)
1029 __field(int, op_flags)
Jaegeuk Kima912b542017-05-10 11:18:25 -07001030 __field(int, temp)
Chao Yu3e1c8f12014-12-23 16:35:21 +08001031 __field(int, type)
1032 ),
1033
1034 TP_fast_assign(
Jaegeuk Kim4969c062019-07-01 19:15:29 -07001035 __entry->dev = page_file_mapping(page)->host->i_sb->s_dev;
1036 __entry->ino = page_file_mapping(page)->host->i_ino;
Chao Yu3e1c8f12014-12-23 16:35:21 +08001037 __entry->index = page->index;
Chao Yu7a9d7542016-02-22 18:36:38 +08001038 __entry->old_blkaddr = fio->old_blkaddr;
1039 __entry->new_blkaddr = fio->new_blkaddr;
Mike Christie04d328d2016-06-05 14:31:55 -05001040 __entry->op = fio->op;
1041 __entry->op_flags = fio->op_flags;
Jaegeuk Kima912b542017-05-10 11:18:25 -07001042 __entry->temp = fio->temp;
Chao Yu2ace38e2014-12-24 16:08:14 +08001043 __entry->type = fio->type;
Chao Yu3e1c8f12014-12-23 16:35:21 +08001044 ),
1045
1046 TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, "
Jaegeuk Kima912b542017-05-10 11:18:25 -07001047 "oldaddr = 0x%llx, newaddr = 0x%llx, rw = %s(%s), type = %s_%s",
Chao Yu3e1c8f12014-12-23 16:35:21 +08001048 show_dev_ino(__entry),
1049 (unsigned long)__entry->index,
Chao Yu7a9d7542016-02-22 18:36:38 +08001050 (unsigned long long)__entry->old_blkaddr,
1051 (unsigned long long)__entry->new_blkaddr,
Jaegeuk Kimd621e6b2016-12-21 14:26:39 -08001052 show_bio_type(__entry->op, __entry->op_flags),
Jaegeuk Kima912b542017-05-10 11:18:25 -07001053 show_block_temp(__entry->temp),
Chao Yu3e1c8f12014-12-23 16:35:21 +08001054 show_block_type(__entry->type))
1055);
1056
1057DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_bio,
1058
Chao Yu2ace38e2014-12-24 16:08:14 +08001059 TP_PROTO(struct page *page, struct f2fs_io_info *fio),
Chao Yu3e1c8f12014-12-23 16:35:21 +08001060
Chao Yu2ace38e2014-12-24 16:08:14 +08001061 TP_ARGS(page, fio),
Chao Yu3e1c8f12014-12-23 16:35:21 +08001062
1063 TP_CONDITION(page->mapping)
1064);
1065
Jaegeuk Kimb9109b02017-05-10 11:28:38 -07001066DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_write,
Chao Yu3e1c8f12014-12-23 16:35:21 +08001067
Chao Yu2ace38e2014-12-24 16:08:14 +08001068 TP_PROTO(struct page *page, struct f2fs_io_info *fio),
Chao Yu3e1c8f12014-12-23 16:35:21 +08001069
Chao Yu2ace38e2014-12-24 16:08:14 +08001070 TP_ARGS(page, fio),
Chao Yu3e1c8f12014-12-23 16:35:21 +08001071
1072 TP_CONDITION(page->mapping)
1073);
1074
Jaegeuk Kim554b5122016-12-21 12:13:03 -08001075DECLARE_EVENT_CLASS(f2fs__bio,
Namjae Jeon6ec178d2013-04-23 17:51:43 +09001076
Jaegeuk Kim554b5122016-12-21 12:13:03 -08001077 TP_PROTO(struct super_block *sb, int type, struct bio *bio),
Namjae Jeon6ec178d2013-04-23 17:51:43 +09001078
Jaegeuk Kim554b5122016-12-21 12:13:03 -08001079 TP_ARGS(sb, type, bio),
Namjae Jeon6ec178d2013-04-23 17:51:43 +09001080
1081 TP_STRUCT__entry(
1082 __field(dev_t, dev)
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001083 __field(dev_t, target)
Mike Christie04d328d2016-06-05 14:31:55 -05001084 __field(int, op)
1085 __field(int, op_flags)
Chao Yud4d288b2013-11-24 12:36:42 +09001086 __field(int, type)
Namjae Jeon6ec178d2013-04-23 17:51:43 +09001087 __field(sector_t, sector)
1088 __field(unsigned int, size)
1089 ),
1090
1091 TP_fast_assign(
1092 __entry->dev = sb->s_dev;
Christoph Hellwig74d46992017-08-23 19:10:32 +02001093 __entry->target = bio_dev(bio);
Jaegeuk Kim554b5122016-12-21 12:13:03 -08001094 __entry->op = bio_op(bio);
1095 __entry->op_flags = bio->bi_opf;
1096 __entry->type = type;
Kent Overstreet4f024f32013-10-11 15:44:27 -07001097 __entry->sector = bio->bi_iter.bi_sector;
1098 __entry->size = bio->bi_iter.bi_size;
Namjae Jeon6ec178d2013-04-23 17:51:43 +09001099 ),
1100
Chao Yubaaabbb2017-05-04 09:35:43 +08001101 TP_printk("dev = (%d,%d)/(%d,%d), rw = %s(%s), %s, sector = %lld, size = %u",
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001102 show_dev(__entry->target),
1103 show_dev(__entry->dev),
Jaegeuk Kimd621e6b2016-12-21 14:26:39 -08001104 show_bio_type(__entry->op, __entry->op_flags),
Chao Yud4d288b2013-11-24 12:36:42 +09001105 show_block_type(__entry->type),
Namjae Jeon6ec178d2013-04-23 17:51:43 +09001106 (unsigned long long)__entry->sector,
1107 __entry->size)
1108);
1109
Jaegeuk Kim554b5122016-12-21 12:13:03 -08001110DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_prepare_write_bio,
Chao Yud4d288b2013-11-24 12:36:42 +09001111
Jaegeuk Kim554b5122016-12-21 12:13:03 -08001112 TP_PROTO(struct super_block *sb, int type, struct bio *bio),
Chao Yud4d288b2013-11-24 12:36:42 +09001113
Jaegeuk Kim554b5122016-12-21 12:13:03 -08001114 TP_ARGS(sb, type, bio),
Jaegeuk Kim93dfe2a2013-11-30 12:51:14 +09001115
1116 TP_CONDITION(bio)
Chao Yud4d288b2013-11-24 12:36:42 +09001117);
1118
Jaegeuk Kim554b5122016-12-21 12:13:03 -08001119DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_prepare_read_bio,
Chao Yud4d288b2013-11-24 12:36:42 +09001120
Jaegeuk Kim554b5122016-12-21 12:13:03 -08001121 TP_PROTO(struct super_block *sb, int type, struct bio *bio),
Chao Yud4d288b2013-11-24 12:36:42 +09001122
Jaegeuk Kim554b5122016-12-21 12:13:03 -08001123 TP_ARGS(sb, type, bio),
1124
1125 TP_CONDITION(bio)
1126);
1127
1128DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_read_bio,
1129
1130 TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1131
1132 TP_ARGS(sb, type, bio),
1133
1134 TP_CONDITION(bio)
1135);
1136
1137DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_write_bio,
1138
1139 TP_PROTO(struct super_block *sb, int type, struct bio *bio),
1140
1141 TP_ARGS(sb, type, bio),
Jaegeuk Kim93dfe2a2013-11-30 12:51:14 +09001142
1143 TP_CONDITION(bio)
Chao Yud4d288b2013-11-24 12:36:42 +09001144);
1145
Chao Yu62aed042014-05-06 16:46:04 +08001146TRACE_EVENT(f2fs_write_begin,
1147
1148 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
1149 unsigned int flags),
1150
1151 TP_ARGS(inode, pos, len, flags),
1152
1153 TP_STRUCT__entry(
1154 __field(dev_t, dev)
1155 __field(ino_t, ino)
1156 __field(loff_t, pos)
1157 __field(unsigned int, len)
1158 __field(unsigned int, flags)
1159 ),
1160
1161 TP_fast_assign(
1162 __entry->dev = inode->i_sb->s_dev;
1163 __entry->ino = inode->i_ino;
1164 __entry->pos = pos;
1165 __entry->len = len;
1166 __entry->flags = flags;
1167 ),
1168
1169 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, flags = %u",
1170 show_dev_ino(__entry),
1171 (unsigned long long)__entry->pos,
1172 __entry->len,
1173 __entry->flags)
1174);
1175
Chao Yudfb2bf32014-05-06 16:47:23 +08001176TRACE_EVENT(f2fs_write_end,
1177
1178 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
1179 unsigned int copied),
1180
1181 TP_ARGS(inode, pos, len, copied),
1182
1183 TP_STRUCT__entry(
1184 __field(dev_t, dev)
1185 __field(ino_t, ino)
1186 __field(loff_t, pos)
1187 __field(unsigned int, len)
1188 __field(unsigned int, copied)
1189 ),
1190
1191 TP_fast_assign(
1192 __entry->dev = inode->i_sb->s_dev;
1193 __entry->ino = inode->i_ino;
1194 __entry->pos = pos;
1195 __entry->len = len;
1196 __entry->copied = copied;
1197 ),
1198
1199 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, copied = %u",
1200 show_dev_ino(__entry),
1201 (unsigned long long)__entry->pos,
1202 __entry->len,
1203 __entry->copied)
1204);
1205
Jaegeuk Kim26c6b882013-10-24 17:53:29 +09001206DECLARE_EVENT_CLASS(f2fs__page,
1207
1208 TP_PROTO(struct page *page, int type),
1209
1210 TP_ARGS(page, type),
1211
1212 TP_STRUCT__entry(
1213 __field(dev_t, dev)
1214 __field(ino_t, ino)
1215 __field(int, type)
1216 __field(int, dir)
1217 __field(pgoff_t, index)
1218 __field(int, dirty)
Chao Yuc20e89c2014-05-06 16:53:08 +08001219 __field(int, uptodate)
Jaegeuk Kim26c6b882013-10-24 17:53:29 +09001220 ),
1221
1222 TP_fast_assign(
Jaegeuk Kim4969c062019-07-01 19:15:29 -07001223 __entry->dev = page_file_mapping(page)->host->i_sb->s_dev;
1224 __entry->ino = page_file_mapping(page)->host->i_ino;
Jaegeuk Kim26c6b882013-10-24 17:53:29 +09001225 __entry->type = type;
Jaegeuk Kim4969c062019-07-01 19:15:29 -07001226 __entry->dir =
1227 S_ISDIR(page_file_mapping(page)->host->i_mode);
Jaegeuk Kim26c6b882013-10-24 17:53:29 +09001228 __entry->index = page->index;
1229 __entry->dirty = PageDirty(page);
Chao Yuc20e89c2014-05-06 16:53:08 +08001230 __entry->uptodate = PageUptodate(page);
Jaegeuk Kim26c6b882013-10-24 17:53:29 +09001231 ),
1232
Chao Yuc20e89c2014-05-06 16:53:08 +08001233 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, "
1234 "dirty = %d, uptodate = %d",
Jaegeuk Kim26c6b882013-10-24 17:53:29 +09001235 show_dev_ino(__entry),
1236 show_block_type(__entry->type),
1237 show_file_type(__entry->dir),
1238 (unsigned long)__entry->index,
Chao Yuc20e89c2014-05-06 16:53:08 +08001239 __entry->dirty,
1240 __entry->uptodate)
Jaegeuk Kim26c6b882013-10-24 17:53:29 +09001241);
1242
Chao Yuecda0de2014-05-06 16:48:26 +08001243DEFINE_EVENT(f2fs__page, f2fs_writepage,
1244
1245 TP_PROTO(struct page *page, int type),
1246
1247 TP_ARGS(page, type)
1248);
1249
Jaegeuk Kim8ce67cb2015-03-17 17:58:08 -07001250DEFINE_EVENT(f2fs__page, f2fs_do_write_data_page,
1251
1252 TP_PROTO(struct page *page, int type),
1253
1254 TP_ARGS(page, type)
1255);
1256
Chao Yuc20e89c2014-05-06 16:53:08 +08001257DEFINE_EVENT(f2fs__page, f2fs_readpage,
1258
1259 TP_PROTO(struct page *page, int type),
1260
1261 TP_ARGS(page, type)
1262);
1263
Jaegeuk Kim26c6b882013-10-24 17:53:29 +09001264DEFINE_EVENT(f2fs__page, f2fs_set_page_dirty,
1265
1266 TP_PROTO(struct page *page, int type),
1267
1268 TP_ARGS(page, type)
1269);
1270
Jaegeuk Kime943a102013-10-25 14:26:31 +09001271DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite,
1272
1273 TP_PROTO(struct page *page, int type),
1274
1275 TP_ARGS(page, type)
1276);
1277
Jaegeuk Kim8ce67cb2015-03-17 17:58:08 -07001278DEFINE_EVENT(f2fs__page, f2fs_register_inmem_page,
1279
1280 TP_PROTO(struct page *page, int type),
1281
1282 TP_ARGS(page, type)
1283);
1284
1285DEFINE_EVENT(f2fs__page, f2fs_commit_inmem_page,
1286
1287 TP_PROTO(struct page *page, int type),
1288
1289 TP_ARGS(page, type)
1290);
1291
Chao Yud7648342019-04-15 15:22:19 +08001292TRACE_EVENT(f2fs_filemap_fault,
1293
1294 TP_PROTO(struct inode *inode, pgoff_t index, unsigned long ret),
1295
1296 TP_ARGS(inode, index, ret),
1297
1298 TP_STRUCT__entry(
1299 __field(dev_t, dev)
1300 __field(ino_t, ino)
1301 __field(pgoff_t, index)
1302 __field(unsigned long, ret)
1303 ),
1304
1305 TP_fast_assign(
1306 __entry->dev = inode->i_sb->s_dev;
1307 __entry->ino = inode->i_ino;
1308 __entry->index = index;
1309 __entry->ret = ret;
1310 ),
1311
1312 TP_printk("dev = (%d,%d), ino = %lu, index = %lu, ret = %lx",
1313 show_dev_ino(__entry),
1314 (unsigned long)__entry->index,
1315 __entry->ret)
1316);
1317
Chao Yue5748432014-05-06 16:51:24 +08001318TRACE_EVENT(f2fs_writepages,
1319
1320 TP_PROTO(struct inode *inode, struct writeback_control *wbc, int type),
1321
1322 TP_ARGS(inode, wbc, type),
1323
1324 TP_STRUCT__entry(
1325 __field(dev_t, dev)
1326 __field(ino_t, ino)
1327 __field(int, type)
1328 __field(int, dir)
1329 __field(long, nr_to_write)
1330 __field(long, pages_skipped)
1331 __field(loff_t, range_start)
1332 __field(loff_t, range_end)
1333 __field(pgoff_t, writeback_index)
1334 __field(int, sync_mode)
1335 __field(char, for_kupdate)
1336 __field(char, for_background)
1337 __field(char, tagged_writepages)
1338 __field(char, for_reclaim)
1339 __field(char, range_cyclic)
1340 __field(char, for_sync)
1341 ),
1342
1343 TP_fast_assign(
1344 __entry->dev = inode->i_sb->s_dev;
1345 __entry->ino = inode->i_ino;
1346 __entry->type = type;
1347 __entry->dir = S_ISDIR(inode->i_mode);
1348 __entry->nr_to_write = wbc->nr_to_write;
1349 __entry->pages_skipped = wbc->pages_skipped;
1350 __entry->range_start = wbc->range_start;
1351 __entry->range_end = wbc->range_end;
1352 __entry->writeback_index = inode->i_mapping->writeback_index;
1353 __entry->sync_mode = wbc->sync_mode;
1354 __entry->for_kupdate = wbc->for_kupdate;
1355 __entry->for_background = wbc->for_background;
1356 __entry->tagged_writepages = wbc->tagged_writepages;
1357 __entry->for_reclaim = wbc->for_reclaim;
1358 __entry->range_cyclic = wbc->range_cyclic;
1359 __entry->for_sync = wbc->for_sync;
1360 ),
1361
1362 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, "
1363 "skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, "
1364 "kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u",
1365 show_dev_ino(__entry),
1366 show_block_type(__entry->type),
1367 show_file_type(__entry->dir),
1368 __entry->nr_to_write,
1369 __entry->pages_skipped,
1370 __entry->range_start,
1371 __entry->range_end,
1372 (unsigned long)__entry->writeback_index,
1373 __entry->sync_mode,
1374 __entry->for_kupdate,
1375 __entry->for_background,
1376 __entry->tagged_writepages,
1377 __entry->for_reclaim,
1378 __entry->range_cyclic,
1379 __entry->for_sync)
1380);
1381
Chao Yub8c29402015-10-12 17:02:26 +08001382TRACE_EVENT(f2fs_readpages,
1383
Matthew Wilcox (Oracle)23323192020-06-01 21:47:23 -07001384 TP_PROTO(struct inode *inode, pgoff_t start, unsigned int nrpage),
Chao Yub8c29402015-10-12 17:02:26 +08001385
Matthew Wilcox (Oracle)23323192020-06-01 21:47:23 -07001386 TP_ARGS(inode, start, nrpage),
Chao Yub8c29402015-10-12 17:02:26 +08001387
1388 TP_STRUCT__entry(
1389 __field(dev_t, dev)
1390 __field(ino_t, ino)
1391 __field(pgoff_t, start)
1392 __field(unsigned int, nrpage)
1393 ),
1394
1395 TP_fast_assign(
1396 __entry->dev = inode->i_sb->s_dev;
1397 __entry->ino = inode->i_ino;
Matthew Wilcox (Oracle)23323192020-06-01 21:47:23 -07001398 __entry->start = start;
Chao Yub8c29402015-10-12 17:02:26 +08001399 __entry->nrpage = nrpage;
1400 ),
1401
1402 TP_printk("dev = (%d,%d), ino = %lu, start = %lu nrpage = %u",
1403 show_dev_ino(__entry),
1404 (unsigned long)__entry->start,
1405 __entry->nrpage)
1406);
1407
Namjae Jeon2af4bd62013-04-23 18:26:54 +09001408TRACE_EVENT(f2fs_write_checkpoint,
1409
Jaegeuk Kim75ab4cb2014-09-20 21:57:51 -07001410 TP_PROTO(struct super_block *sb, int reason, char *msg),
Namjae Jeon2af4bd62013-04-23 18:26:54 +09001411
Jaegeuk Kim75ab4cb2014-09-20 21:57:51 -07001412 TP_ARGS(sb, reason, msg),
Namjae Jeon2af4bd62013-04-23 18:26:54 +09001413
1414 TP_STRUCT__entry(
1415 __field(dev_t, dev)
Jaegeuk Kim75ab4cb2014-09-20 21:57:51 -07001416 __field(int, reason)
Namjae Jeon2af4bd62013-04-23 18:26:54 +09001417 __field(char *, msg)
1418 ),
1419
1420 TP_fast_assign(
1421 __entry->dev = sb->s_dev;
Jaegeuk Kim75ab4cb2014-09-20 21:57:51 -07001422 __entry->reason = reason;
Namjae Jeon2af4bd62013-04-23 18:26:54 +09001423 __entry->msg = msg;
1424 ),
1425
1426 TP_printk("dev = (%d,%d), checkpoint for %s, state = %s",
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001427 show_dev(__entry->dev),
Jaegeuk Kim75ab4cb2014-09-20 21:57:51 -07001428 show_cpreason(__entry->reason),
Namjae Jeon2af4bd62013-04-23 18:26:54 +09001429 __entry->msg)
1430);
1431
Chao Yu0243a5f2017-04-15 14:09:38 +08001432DECLARE_EVENT_CLASS(f2fs_discard,
Jaegeuk Kim1661d072013-11-12 17:01:00 +09001433
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001434 TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
Jaegeuk Kim1661d072013-11-12 17:01:00 +09001435
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001436 TP_ARGS(dev, blkstart, blklen),
Jaegeuk Kim1661d072013-11-12 17:01:00 +09001437
1438 TP_STRUCT__entry(
1439 __field(dev_t, dev)
1440 __field(block_t, blkstart)
1441 __field(block_t, blklen)
1442 ),
1443
1444 TP_fast_assign(
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001445 __entry->dev = dev->bd_dev;
Jaegeuk Kim1661d072013-11-12 17:01:00 +09001446 __entry->blkstart = blkstart;
1447 __entry->blklen = blklen;
1448 ),
1449
1450 TP_printk("dev = (%d,%d), blkstart = 0x%llx, blklen = 0x%llx",
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001451 show_dev(__entry->dev),
Jaegeuk Kim1661d072013-11-12 17:01:00 +09001452 (unsigned long long)__entry->blkstart,
1453 (unsigned long long)__entry->blklen)
1454);
Jaegeuk Kim24a9ee02014-07-25 17:46:10 -07001455
Chao Yu0243a5f2017-04-15 14:09:38 +08001456DEFINE_EVENT(f2fs_discard, f2fs_queue_discard,
1457
1458 TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
1459
1460 TP_ARGS(dev, blkstart, blklen)
1461);
1462
1463DEFINE_EVENT(f2fs_discard, f2fs_issue_discard,
1464
1465 TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
1466
1467 TP_ARGS(dev, blkstart, blklen)
1468);
1469
Chao Yu2ec6f2e2017-10-04 09:08:36 +08001470DEFINE_EVENT(f2fs_discard, f2fs_remove_discard,
1471
1472 TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
1473
1474 TP_ARGS(dev, blkstart, blklen)
1475);
1476
Damien Le Moal126606c2016-10-28 17:45:07 +09001477TRACE_EVENT(f2fs_issue_reset_zone,
1478
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001479 TP_PROTO(struct block_device *dev, block_t blkstart),
Damien Le Moal126606c2016-10-28 17:45:07 +09001480
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001481 TP_ARGS(dev, blkstart),
Damien Le Moal126606c2016-10-28 17:45:07 +09001482
1483 TP_STRUCT__entry(
1484 __field(dev_t, dev)
1485 __field(block_t, blkstart)
1486 ),
1487
1488 TP_fast_assign(
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001489 __entry->dev = dev->bd_dev;
Damien Le Moal126606c2016-10-28 17:45:07 +09001490 __entry->blkstart = blkstart;
1491 ),
1492
1493 TP_printk("dev = (%d,%d), reset zone at block = 0x%llx",
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001494 show_dev(__entry->dev),
Damien Le Moal126606c2016-10-28 17:45:07 +09001495 (unsigned long long)__entry->blkstart)
1496);
1497
Jaegeuk Kim24a9ee02014-07-25 17:46:10 -07001498TRACE_EVENT(f2fs_issue_flush,
1499
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001500 TP_PROTO(struct block_device *dev, unsigned int nobarrier,
Kinglong Mee20fda56b2017-03-04 22:13:10 +08001501 unsigned int flush_merge, int ret),
Jaegeuk Kim24a9ee02014-07-25 17:46:10 -07001502
Kinglong Mee20fda56b2017-03-04 22:13:10 +08001503 TP_ARGS(dev, nobarrier, flush_merge, ret),
Jaegeuk Kim24a9ee02014-07-25 17:46:10 -07001504
1505 TP_STRUCT__entry(
1506 __field(dev_t, dev)
Jaegeuk Kim29e70432015-02-10 16:23:12 -08001507 __field(unsigned int, nobarrier)
1508 __field(unsigned int, flush_merge)
Kinglong Mee20fda56b2017-03-04 22:13:10 +08001509 __field(int, ret)
Jaegeuk Kim24a9ee02014-07-25 17:46:10 -07001510 ),
1511
1512 TP_fast_assign(
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001513 __entry->dev = dev->bd_dev;
Jaegeuk Kim24a9ee02014-07-25 17:46:10 -07001514 __entry->nobarrier = nobarrier;
1515 __entry->flush_merge = flush_merge;
Kinglong Mee20fda56b2017-03-04 22:13:10 +08001516 __entry->ret = ret;
Jaegeuk Kim24a9ee02014-07-25 17:46:10 -07001517 ),
1518
Kinglong Mee20fda56b2017-03-04 22:13:10 +08001519 TP_printk("dev = (%d,%d), %s %s, ret = %d",
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001520 show_dev(__entry->dev),
Jaegeuk Kim24a9ee02014-07-25 17:46:10 -07001521 __entry->nobarrier ? "skip (nobarrier)" : "issue",
Kinglong Mee20fda56b2017-03-04 22:13:10 +08001522 __entry->flush_merge ? " with flush_merge" : "",
1523 __entry->ret)
Jaegeuk Kim24a9ee02014-07-25 17:46:10 -07001524);
Chao Yu1ec46102015-02-05 17:59:59 +08001525
1526TRACE_EVENT(f2fs_lookup_extent_tree_start,
1527
1528 TP_PROTO(struct inode *inode, unsigned int pgofs),
1529
1530 TP_ARGS(inode, pgofs),
1531
1532 TP_STRUCT__entry(
1533 __field(dev_t, dev)
1534 __field(ino_t, ino)
1535 __field(unsigned int, pgofs)
1536 ),
1537
1538 TP_fast_assign(
1539 __entry->dev = inode->i_sb->s_dev;
1540 __entry->ino = inode->i_ino;
1541 __entry->pgofs = pgofs;
1542 ),
1543
1544 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u",
1545 show_dev_ino(__entry),
1546 __entry->pgofs)
1547);
1548
1549TRACE_EVENT_CONDITION(f2fs_lookup_extent_tree_end,
1550
1551 TP_PROTO(struct inode *inode, unsigned int pgofs,
Jaegeuk Kim84bc9262015-06-29 16:01:14 -07001552 struct extent_info *ei),
Chao Yu1ec46102015-02-05 17:59:59 +08001553
Jaegeuk Kim84bc9262015-06-29 16:01:14 -07001554 TP_ARGS(inode, pgofs, ei),
Chao Yu1ec46102015-02-05 17:59:59 +08001555
Jaegeuk Kim84bc9262015-06-29 16:01:14 -07001556 TP_CONDITION(ei),
Chao Yu1ec46102015-02-05 17:59:59 +08001557
1558 TP_STRUCT__entry(
1559 __field(dev_t, dev)
1560 __field(ino_t, ino)
1561 __field(unsigned int, pgofs)
1562 __field(unsigned int, fofs)
1563 __field(u32, blk)
1564 __field(unsigned int, len)
1565 ),
1566
1567 TP_fast_assign(
1568 __entry->dev = inode->i_sb->s_dev;
1569 __entry->ino = inode->i_ino;
1570 __entry->pgofs = pgofs;
Jaegeuk Kim84bc9262015-06-29 16:01:14 -07001571 __entry->fofs = ei->fofs;
1572 __entry->blk = ei->blk;
1573 __entry->len = ei->len;
Chao Yu1ec46102015-02-05 17:59:59 +08001574 ),
1575
1576 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1577 "ext_info(fofs: %u, blk: %u, len: %u)",
1578 show_dev_ino(__entry),
1579 __entry->pgofs,
1580 __entry->fofs,
1581 __entry->blk,
1582 __entry->len)
1583);
1584
Chao Yu744288c2015-09-06 17:50:13 +08001585TRACE_EVENT(f2fs_update_extent_tree_range,
Chao Yu1ec46102015-02-05 17:59:59 +08001586
Chao Yu744288c2015-09-06 17:50:13 +08001587 TP_PROTO(struct inode *inode, unsigned int pgofs, block_t blkaddr,
1588 unsigned int len),
Chao Yu1ec46102015-02-05 17:59:59 +08001589
Chao Yu744288c2015-09-06 17:50:13 +08001590 TP_ARGS(inode, pgofs, blkaddr, len),
Chao Yu1ec46102015-02-05 17:59:59 +08001591
1592 TP_STRUCT__entry(
1593 __field(dev_t, dev)
1594 __field(ino_t, ino)
1595 __field(unsigned int, pgofs)
1596 __field(u32, blk)
Chao Yu744288c2015-09-06 17:50:13 +08001597 __field(unsigned int, len)
Chao Yu1ec46102015-02-05 17:59:59 +08001598 ),
1599
1600 TP_fast_assign(
1601 __entry->dev = inode->i_sb->s_dev;
1602 __entry->ino = inode->i_ino;
1603 __entry->pgofs = pgofs;
1604 __entry->blk = blkaddr;
Chao Yu744288c2015-09-06 17:50:13 +08001605 __entry->len = len;
Chao Yu1ec46102015-02-05 17:59:59 +08001606 ),
1607
Chao Yu744288c2015-09-06 17:50:13 +08001608 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1609 "blkaddr = %u, len = %u",
Chao Yu1ec46102015-02-05 17:59:59 +08001610 show_dev_ino(__entry),
1611 __entry->pgofs,
Chao Yu744288c2015-09-06 17:50:13 +08001612 __entry->blk,
1613 __entry->len)
Chao Yu1ec46102015-02-05 17:59:59 +08001614);
1615
1616TRACE_EVENT(f2fs_shrink_extent_tree,
1617
1618 TP_PROTO(struct f2fs_sb_info *sbi, unsigned int node_cnt,
1619 unsigned int tree_cnt),
1620
1621 TP_ARGS(sbi, node_cnt, tree_cnt),
1622
1623 TP_STRUCT__entry(
1624 __field(dev_t, dev)
1625 __field(unsigned int, node_cnt)
1626 __field(unsigned int, tree_cnt)
1627 ),
1628
1629 TP_fast_assign(
1630 __entry->dev = sbi->sb->s_dev;
1631 __entry->node_cnt = node_cnt;
1632 __entry->tree_cnt = tree_cnt;
1633 ),
1634
1635 TP_printk("dev = (%d,%d), shrunk: node_cnt = %u, tree_cnt = %u",
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001636 show_dev(__entry->dev),
Chao Yu1ec46102015-02-05 17:59:59 +08001637 __entry->node_cnt,
1638 __entry->tree_cnt)
1639);
1640
1641TRACE_EVENT(f2fs_destroy_extent_tree,
1642
1643 TP_PROTO(struct inode *inode, unsigned int node_cnt),
1644
1645 TP_ARGS(inode, node_cnt),
1646
1647 TP_STRUCT__entry(
1648 __field(dev_t, dev)
1649 __field(ino_t, ino)
1650 __field(unsigned int, node_cnt)
1651 ),
1652
1653 TP_fast_assign(
1654 __entry->dev = inode->i_sb->s_dev;
1655 __entry->ino = inode->i_ino;
1656 __entry->node_cnt = node_cnt;
1657 ),
1658
1659 TP_printk("dev = (%d,%d), ino = %lu, destroyed: node_cnt = %u",
1660 show_dev_ino(__entry),
1661 __entry->node_cnt)
1662);
1663
Chao Yu4cf18532015-12-17 17:17:16 +08001664DECLARE_EVENT_CLASS(f2fs_sync_dirty_inodes,
1665
Jaegeuk Kim523be8a2016-05-13 12:36:58 -07001666 TP_PROTO(struct super_block *sb, int type, s64 count),
Chao Yu4cf18532015-12-17 17:17:16 +08001667
1668 TP_ARGS(sb, type, count),
1669
1670 TP_STRUCT__entry(
1671 __field(dev_t, dev)
1672 __field(int, type)
Jaegeuk Kim523be8a2016-05-13 12:36:58 -07001673 __field(s64, count)
Chao Yu4cf18532015-12-17 17:17:16 +08001674 ),
1675
1676 TP_fast_assign(
1677 __entry->dev = sb->s_dev;
1678 __entry->type = type;
1679 __entry->count = count;
1680 ),
1681
Jaegeuk Kim523be8a2016-05-13 12:36:58 -07001682 TP_printk("dev = (%d,%d), %s, dirty count = %lld",
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001683 show_dev(__entry->dev),
Chao Yu4cf18532015-12-17 17:17:16 +08001684 show_file_type(__entry->type),
1685 __entry->count)
1686);
1687
1688DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_enter,
1689
Jaegeuk Kim523be8a2016-05-13 12:36:58 -07001690 TP_PROTO(struct super_block *sb, int type, s64 count),
Chao Yu4cf18532015-12-17 17:17:16 +08001691
1692 TP_ARGS(sb, type, count)
1693);
1694
1695DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_exit,
1696
Jaegeuk Kim523be8a2016-05-13 12:36:58 -07001697 TP_PROTO(struct super_block *sb, int type, s64 count),
Chao Yu4cf18532015-12-17 17:17:16 +08001698
1699 TP_ARGS(sb, type, count)
1700);
1701
Chao Yu559e87c2019-02-26 19:01:15 +08001702TRACE_EVENT(f2fs_shutdown,
1703
1704 TP_PROTO(struct f2fs_sb_info *sbi, unsigned int mode, int ret),
1705
1706 TP_ARGS(sbi, mode, ret),
1707
1708 TP_STRUCT__entry(
1709 __field(dev_t, dev)
1710 __field(unsigned int, mode)
1711 __field(int, ret)
1712 ),
1713
1714 TP_fast_assign(
1715 __entry->dev = sbi->sb->s_dev;
1716 __entry->mode = mode;
1717 __entry->ret = ret;
1718 ),
1719
1720 TP_printk("dev = (%d,%d), mode: %s, ret:%d",
1721 show_dev(__entry->dev),
1722 show_shutdown_mode(__entry->mode),
1723 __entry->ret)
1724);
1725
Chao Yu4c8ff702019-11-01 18:07:14 +08001726DECLARE_EVENT_CLASS(f2fs_zip_start,
1727
1728 TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1729 unsigned int cluster_size, unsigned char algtype),
1730
1731 TP_ARGS(inode, cluster_idx, cluster_size, algtype),
1732
1733 TP_STRUCT__entry(
1734 __field(dev_t, dev)
1735 __field(ino_t, ino)
1736 __field(pgoff_t, idx)
1737 __field(unsigned int, size)
1738 __field(unsigned int, algtype)
1739 ),
1740
1741 TP_fast_assign(
1742 __entry->dev = inode->i_sb->s_dev;
1743 __entry->ino = inode->i_ino;
1744 __entry->idx = cluster_idx;
1745 __entry->size = cluster_size;
1746 __entry->algtype = algtype;
1747 ),
1748
1749 TP_printk("dev = (%d,%d), ino = %lu, cluster_idx:%lu, "
1750 "cluster_size = %u, algorithm = %s",
1751 show_dev_ino(__entry),
1752 __entry->idx,
1753 __entry->size,
1754 show_compress_algorithm(__entry->algtype))
1755);
1756
1757DECLARE_EVENT_CLASS(f2fs_zip_end,
1758
1759 TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1760 unsigned int compressed_size, int ret),
1761
1762 TP_ARGS(inode, cluster_idx, compressed_size, ret),
1763
1764 TP_STRUCT__entry(
1765 __field(dev_t, dev)
1766 __field(ino_t, ino)
1767 __field(pgoff_t, idx)
1768 __field(unsigned int, size)
1769 __field(unsigned int, ret)
1770 ),
1771
1772 TP_fast_assign(
1773 __entry->dev = inode->i_sb->s_dev;
1774 __entry->ino = inode->i_ino;
1775 __entry->idx = cluster_idx;
1776 __entry->size = compressed_size;
1777 __entry->ret = ret;
1778 ),
1779
1780 TP_printk("dev = (%d,%d), ino = %lu, cluster_idx:%lu, "
1781 "compressed_size = %u, ret = %d",
1782 show_dev_ino(__entry),
1783 __entry->idx,
1784 __entry->size,
1785 __entry->ret)
1786);
1787
1788DEFINE_EVENT(f2fs_zip_start, f2fs_compress_pages_start,
1789
1790 TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1791 unsigned int cluster_size, unsigned char algtype),
1792
1793 TP_ARGS(inode, cluster_idx, cluster_size, algtype)
1794);
1795
1796DEFINE_EVENT(f2fs_zip_start, f2fs_decompress_pages_start,
1797
1798 TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1799 unsigned int cluster_size, unsigned char algtype),
1800
1801 TP_ARGS(inode, cluster_idx, cluster_size, algtype)
1802);
1803
1804DEFINE_EVENT(f2fs_zip_end, f2fs_compress_pages_end,
1805
1806 TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1807 unsigned int compressed_size, int ret),
1808
1809 TP_ARGS(inode, cluster_idx, compressed_size, ret)
1810);
1811
1812DEFINE_EVENT(f2fs_zip_end, f2fs_decompress_pages_end,
1813
1814 TP_PROTO(struct inode *inode, pgoff_t cluster_idx,
1815 unsigned int compressed_size, int ret),
1816
1817 TP_ARGS(inode, cluster_idx, compressed_size, ret)
1818);
1819
Daeho Jeong2bc4bea2020-03-30 03:30:59 +00001820TRACE_EVENT(f2fs_iostat,
1821
1822 TP_PROTO(struct f2fs_sb_info *sbi, unsigned long long *iostat),
1823
1824 TP_ARGS(sbi, iostat),
1825
1826 TP_STRUCT__entry(
1827 __field(dev_t, dev)
1828 __field(unsigned long long, app_dio)
1829 __field(unsigned long long, app_bio)
1830 __field(unsigned long long, app_wio)
1831 __field(unsigned long long, app_mio)
1832 __field(unsigned long long, fs_dio)
1833 __field(unsigned long long, fs_nio)
1834 __field(unsigned long long, fs_mio)
1835 __field(unsigned long long, fs_gc_dio)
1836 __field(unsigned long long, fs_gc_nio)
1837 __field(unsigned long long, fs_cp_dio)
1838 __field(unsigned long long, fs_cp_nio)
1839 __field(unsigned long long, fs_cp_mio)
Chao Yu8b83ac82020-04-16 18:16:56 +08001840 __field(unsigned long long, app_drio)
1841 __field(unsigned long long, app_brio)
1842 __field(unsigned long long, app_rio)
1843 __field(unsigned long long, app_mrio)
1844 __field(unsigned long long, fs_drio)
Chao Yu9c122382020-04-23 18:03:06 +08001845 __field(unsigned long long, fs_gdrio)
1846 __field(unsigned long long, fs_cdrio)
Chao Yu8b83ac82020-04-16 18:16:56 +08001847 __field(unsigned long long, fs_nrio)
1848 __field(unsigned long long, fs_mrio)
Daeho Jeong2bc4bea2020-03-30 03:30:59 +00001849 __field(unsigned long long, fs_discard)
1850 ),
1851
1852 TP_fast_assign(
1853 __entry->dev = sbi->sb->s_dev;
1854 __entry->app_dio = iostat[APP_DIRECT_IO];
1855 __entry->app_bio = iostat[APP_BUFFERED_IO];
1856 __entry->app_wio = iostat[APP_WRITE_IO];
1857 __entry->app_mio = iostat[APP_MAPPED_IO];
1858 __entry->fs_dio = iostat[FS_DATA_IO];
1859 __entry->fs_nio = iostat[FS_NODE_IO];
1860 __entry->fs_mio = iostat[FS_META_IO];
1861 __entry->fs_gc_dio = iostat[FS_GC_DATA_IO];
1862 __entry->fs_gc_nio = iostat[FS_GC_NODE_IO];
1863 __entry->fs_cp_dio = iostat[FS_CP_DATA_IO];
1864 __entry->fs_cp_nio = iostat[FS_CP_NODE_IO];
1865 __entry->fs_cp_mio = iostat[FS_CP_META_IO];
Chao Yu8b83ac82020-04-16 18:16:56 +08001866 __entry->app_drio = iostat[APP_DIRECT_READ_IO];
1867 __entry->app_brio = iostat[APP_BUFFERED_READ_IO];
1868 __entry->app_rio = iostat[APP_READ_IO];
1869 __entry->app_mrio = iostat[APP_MAPPED_READ_IO];
1870 __entry->fs_drio = iostat[FS_DATA_READ_IO];
Chao Yu9c122382020-04-23 18:03:06 +08001871 __entry->fs_gdrio = iostat[FS_GDATA_READ_IO];
1872 __entry->fs_cdrio = iostat[FS_CDATA_READ_IO];
Chao Yu8b83ac82020-04-16 18:16:56 +08001873 __entry->fs_nrio = iostat[FS_NODE_READ_IO];
1874 __entry->fs_mrio = iostat[FS_META_READ_IO];
Daeho Jeong2bc4bea2020-03-30 03:30:59 +00001875 __entry->fs_discard = iostat[FS_DISCARD];
1876 ),
1877
1878 TP_printk("dev = (%d,%d), "
1879 "app [write=%llu (direct=%llu, buffered=%llu), mapped=%llu], "
1880 "fs [data=%llu, node=%llu, meta=%llu, discard=%llu], "
1881 "gc [data=%llu, node=%llu], "
Chao Yu8b83ac82020-04-16 18:16:56 +08001882 "cp [data=%llu, node=%llu, meta=%llu], "
1883 "app [read=%llu (direct=%llu, buffered=%llu), mapped=%llu], "
Chao Yu9c122382020-04-23 18:03:06 +08001884 "fs [data=%llu, (gc_data=%llu, compr_data=%llu), "
1885 "node=%llu, meta=%llu]",
Daeho Jeong2bc4bea2020-03-30 03:30:59 +00001886 show_dev(__entry->dev), __entry->app_wio, __entry->app_dio,
1887 __entry->app_bio, __entry->app_mio, __entry->fs_dio,
1888 __entry->fs_nio, __entry->fs_mio, __entry->fs_discard,
1889 __entry->fs_gc_dio, __entry->fs_gc_nio, __entry->fs_cp_dio,
Chao Yu8b83ac82020-04-16 18:16:56 +08001890 __entry->fs_cp_nio, __entry->fs_cp_mio,
1891 __entry->app_rio, __entry->app_drio, __entry->app_brio,
Chao Yu9c122382020-04-23 18:03:06 +08001892 __entry->app_mrio, __entry->fs_drio, __entry->fs_gdrio,
1893 __entry->fs_cdrio, __entry->fs_nrio, __entry->fs_mrio)
Daeho Jeong2bc4bea2020-03-30 03:30:59 +00001894);
1895
Chao Yub79b0a32020-06-29 20:13:12 +08001896TRACE_EVENT(f2fs_bmap,
1897
1898 TP_PROTO(struct inode *inode, sector_t lblock, sector_t pblock),
1899
1900 TP_ARGS(inode, lblock, pblock),
1901
1902 TP_STRUCT__entry(
1903 __field(dev_t, dev)
1904 __field(ino_t, ino)
1905 __field(sector_t, lblock)
1906 __field(sector_t, pblock)
1907 ),
1908
1909 TP_fast_assign(
1910 __entry->dev = inode->i_sb->s_dev;
1911 __entry->ino = inode->i_ino;
1912 __entry->lblock = lblock;
1913 __entry->pblock = pblock;
1914 ),
1915
1916 TP_printk("dev = (%d,%d), ino = %lu, lblock:%lld, pblock:%lld",
1917 show_dev_ino(__entry),
1918 (unsigned long long)__entry->lblock,
1919 (unsigned long long)__entry->pblock)
1920);
1921
Chao Yudd5a09b2020-06-29 20:13:13 +08001922TRACE_EVENT(f2fs_fiemap,
1923
1924 TP_PROTO(struct inode *inode, sector_t lblock, sector_t pblock,
1925 unsigned long long len, unsigned int flags, int ret),
1926
1927 TP_ARGS(inode, lblock, pblock, len, flags, ret),
1928
1929 TP_STRUCT__entry(
1930 __field(dev_t, dev)
1931 __field(ino_t, ino)
1932 __field(sector_t, lblock)
1933 __field(sector_t, pblock)
1934 __field(unsigned long long, len)
1935 __field(unsigned int, flags)
1936 __field(int, ret)
1937 ),
1938
1939 TP_fast_assign(
1940 __entry->dev = inode->i_sb->s_dev;
1941 __entry->ino = inode->i_ino;
1942 __entry->lblock = lblock;
1943 __entry->pblock = pblock;
1944 __entry->len = len;
1945 __entry->flags = flags;
1946 __entry->ret = ret;
1947 ),
1948
1949 TP_printk("dev = (%d,%d), ino = %lu, lblock:%lld, pblock:%lld, "
1950 "len:%llu, flags:%u, ret:%d",
1951 show_dev_ino(__entry),
1952 (unsigned long long)__entry->lblock,
1953 (unsigned long long)__entry->pblock,
1954 __entry->len,
1955 __entry->flags,
1956 __entry->ret)
1957);
1958
Namjae Jeona2a4a7e2013-04-20 01:28:40 +09001959#endif /* _TRACE_F2FS_H */
1960
1961 /* This part must be outside protection */
1962#include <trace/define_trace.h>