blob: 7ab40491485bc0b9604aa07fae9fa4a3575509e1 [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);
Steven Rostedt (Red Hat)5511b9a2015-03-27 16:18:07 -040052
Namjae Jeon6ec178d2013-04-23 17:51:43 +090053#define show_block_type(type) \
54 __print_symbolic(type, \
55 { NODE, "NODE" }, \
56 { DATA, "DATA" }, \
57 { META, "META" }, \
Jaegeuk Kim8ce67cb2015-03-17 17:58:08 -070058 { META_FLUSH, "META_FLUSH" }, \
59 { INMEM, "INMEM" }, \
60 { INMEM_DROP, "INMEM_DROP" }, \
Jaegeuk Kim8c242db2017-03-17 09:55:52 +080061 { INMEM_INVALIDATE, "INMEM_INVALIDATE" }, \
Chao Yu28bc1062016-02-06 14:40:34 +080062 { INMEM_REVOKE, "INMEM_REVOKE" }, \
Jaegeuk Kim8ce67cb2015-03-17 17:58:08 -070063 { IPU, "IN-PLACE" }, \
64 { OPU, "OUT-OF-PLACE" })
Namjae Jeon6ec178d2013-04-23 17:51:43 +090065
Jaegeuk Kima912b542017-05-10 11:18:25 -070066#define show_block_temp(temp) \
67 __print_symbolic(temp, \
68 { HOT, "HOT" }, \
69 { WARM, "WARM" }, \
70 { COLD, "COLD" })
71
Chao Yubaaabbb2017-05-04 09:35:43 +080072#define F2FS_OP_FLAGS (REQ_RAHEAD | REQ_SYNC | REQ_META | REQ_PRIO | \
73 REQ_PREFLUSH | REQ_FUA)
Jaegeuk Kimd621e6b2016-12-21 14:26:39 -080074#define F2FS_BIO_FLAG_MASK(t) (t & F2FS_OP_FLAGS)
Jaegeuk Kima709f4a2013-11-24 14:42:23 +090075
Jaegeuk Kimd621e6b2016-12-21 14:26:39 -080076#define show_bio_type(op,op_flags) show_bio_op(op), \
77 show_bio_op_flags(op_flags)
78
79#define show_bio_op(op) \
80 __print_symbolic(op, \
81 { REQ_OP_READ, "READ" }, \
82 { REQ_OP_WRITE, "WRITE" }, \
83 { REQ_OP_FLUSH, "FLUSH" }, \
84 { REQ_OP_DISCARD, "DISCARD" }, \
85 { REQ_OP_ZONE_REPORT, "ZONE_REPORT" }, \
86 { REQ_OP_SECURE_ERASE, "SECURE_ERASE" }, \
87 { REQ_OP_ZONE_RESET, "ZONE_RESET" }, \
88 { REQ_OP_WRITE_SAME, "WRITE_SAME" }, \
89 { REQ_OP_WRITE_ZEROES, "WRITE_ZEROES" })
Mike Christie04d328d2016-06-05 14:31:55 -050090
91#define show_bio_op_flags(flags) \
Chao Yubaaabbb2017-05-04 09:35:43 +080092 __print_flags(F2FS_BIO_FLAG_MASK(flags), "|", \
93 { REQ_RAHEAD, "R" }, \
94 { REQ_SYNC, "S" }, \
95 { REQ_META, "M" }, \
96 { REQ_PRIO, "P" }, \
97 { REQ_PREFLUSH, "PF" }, \
98 { REQ_FUA, "FUA" })
Jaegeuk Kima709f4a2013-11-24 14:42:23 +090099
Namjae Jeon8e46b3e2013-04-23 16:42:53 +0900100#define show_data_type(type) \
101 __print_symbolic(type, \
102 { CURSEG_HOT_DATA, "Hot DATA" }, \
103 { CURSEG_WARM_DATA, "Warm DATA" }, \
104 { CURSEG_COLD_DATA, "Cold DATA" }, \
105 { CURSEG_HOT_NODE, "Hot NODE" }, \
106 { CURSEG_WARM_NODE, "Warm NODE" }, \
107 { CURSEG_COLD_NODE, "Cold NODE" }, \
108 { NO_CHECK_TYPE, "No TYPE" })
109
Jaegeuk Kim26c6b882013-10-24 17:53:29 +0900110#define show_file_type(type) \
111 __print_symbolic(type, \
112 { 0, "FILE" }, \
113 { 1, "DIR" })
114
Namjae Jeon8e46b3e2013-04-23 16:42:53 +0900115#define show_gc_type(type) \
116 __print_symbolic(type, \
117 { FG_GC, "Foreground GC" }, \
118 { BG_GC, "Background GC" })
119
120#define show_alloc_mode(type) \
121 __print_symbolic(type, \
122 { LFS, "LFS-mode" }, \
123 { SSR, "SSR-mode" })
124
125#define show_victim_policy(type) \
126 __print_symbolic(type, \
127 { GC_GREEDY, "Greedy" }, \
128 { GC_CB, "Cost-Benefit" })
129
Jaegeuk Kim75ab4cb2014-09-20 21:57:51 -0700130#define show_cpreason(type) \
Chao Yubaaabbb2017-05-04 09:35:43 +0800131 __print_flags(type, "|", \
Jaegeuk Kim75ab4cb2014-09-20 21:57:51 -0700132 { CP_UMOUNT, "Umount" }, \
Jaegeuk Kim119ee912015-01-29 11:45:33 -0800133 { CP_FASTBOOT, "Fastboot" }, \
Jaegeuk Kim4b2fecc2014-09-20 22:06:39 -0700134 { CP_SYNC, "Sync" }, \
Jaegeuk Kim10027552015-04-09 17:03:53 -0700135 { CP_RECOVERY, "Recovery" }, \
Chao Yu1f43e2a2017-04-28 13:56:08 +0800136 { CP_DISCARD, "Discard" }, \
Chao Yubaaabbb2017-05-04 09:35:43 +0800137 { CP_UMOUNT, "Umount" }, \
138 { CP_TRIMMED, "Trimmed" })
Jaegeuk Kim75ab4cb2014-09-20 21:57:51 -0700139
Namjae Jeon8e46b3e2013-04-23 16:42:53 +0900140struct victim_sel_policy;
Jaegeuk Kim003a3e12015-04-06 19:55:34 -0700141struct f2fs_map_blocks;
Namjae Jeon8e46b3e2013-04-23 16:42:53 +0900142
Namjae Jeona2a4a7e2013-04-20 01:28:40 +0900143DECLARE_EVENT_CLASS(f2fs__inode,
144
145 TP_PROTO(struct inode *inode),
146
147 TP_ARGS(inode),
148
149 TP_STRUCT__entry(
150 __field(dev_t, dev)
151 __field(ino_t, ino)
152 __field(ino_t, pino)
153 __field(umode_t, mode)
154 __field(loff_t, size)
155 __field(unsigned int, nlink)
156 __field(blkcnt_t, blocks)
157 __field(__u8, advise)
158 ),
159
160 TP_fast_assign(
161 __entry->dev = inode->i_sb->s_dev;
162 __entry->ino = inode->i_ino;
163 __entry->pino = F2FS_I(inode)->i_pino;
164 __entry->mode = inode->i_mode;
165 __entry->nlink = inode->i_nlink;
166 __entry->size = inode->i_size;
167 __entry->blocks = inode->i_blocks;
168 __entry->advise = F2FS_I(inode)->i_advise;
169 ),
170
171 TP_printk("dev = (%d,%d), ino = %lu, pino = %lu, i_mode = 0x%hx, "
172 "i_size = %lld, i_nlink = %u, i_blocks = %llu, i_advise = 0x%x",
173 show_dev_ino(__entry),
174 (unsigned long)__entry->pino,
175 __entry->mode,
176 __entry->size,
177 (unsigned int)__entry->nlink,
178 (unsigned long long)__entry->blocks,
179 (unsigned char)__entry->advise)
180);
181
182DECLARE_EVENT_CLASS(f2fs__inode_exit,
183
184 TP_PROTO(struct inode *inode, int ret),
185
186 TP_ARGS(inode, ret),
187
188 TP_STRUCT__entry(
189 __field(dev_t, dev)
190 __field(ino_t, ino)
191 __field(int, ret)
192 ),
193
194 TP_fast_assign(
195 __entry->dev = inode->i_sb->s_dev;
196 __entry->ino = inode->i_ino;
197 __entry->ret = ret;
198 ),
199
200 TP_printk("dev = (%d,%d), ino = %lu, ret = %d",
201 show_dev_ino(__entry),
202 __entry->ret)
203);
204
205DEFINE_EVENT(f2fs__inode, f2fs_sync_file_enter,
206
207 TP_PROTO(struct inode *inode),
208
209 TP_ARGS(inode)
210);
211
212TRACE_EVENT(f2fs_sync_file_exit,
213
Jaegeuk Kim29e70432015-02-10 16:23:12 -0800214 TP_PROTO(struct inode *inode, int need_cp, int datasync, int ret),
Namjae Jeona2a4a7e2013-04-20 01:28:40 +0900215
216 TP_ARGS(inode, need_cp, datasync, ret),
217
218 TP_STRUCT__entry(
219 __field(dev_t, dev)
220 __field(ino_t, ino)
Jaegeuk Kim29e70432015-02-10 16:23:12 -0800221 __field(int, need_cp)
Namjae Jeona2a4a7e2013-04-20 01:28:40 +0900222 __field(int, datasync)
223 __field(int, ret)
224 ),
225
226 TP_fast_assign(
227 __entry->dev = inode->i_sb->s_dev;
228 __entry->ino = inode->i_ino;
229 __entry->need_cp = need_cp;
230 __entry->datasync = datasync;
231 __entry->ret = ret;
232 ),
233
234 TP_printk("dev = (%d,%d), ino = %lu, checkpoint is %s, "
235 "datasync = %d, ret = %d",
236 show_dev_ino(__entry),
237 __entry->need_cp ? "needed" : "not needed",
238 __entry->datasync,
239 __entry->ret)
240);
241
242TRACE_EVENT(f2fs_sync_fs,
243
244 TP_PROTO(struct super_block *sb, int wait),
245
246 TP_ARGS(sb, wait),
247
248 TP_STRUCT__entry(
249 __field(dev_t, dev)
Jaegeuk Kim29e70432015-02-10 16:23:12 -0800250 __field(int, dirty)
Namjae Jeona2a4a7e2013-04-20 01:28:40 +0900251 __field(int, wait)
252 ),
253
254 TP_fast_assign(
255 __entry->dev = sb->s_dev;
Chao Yucaf00472015-01-28 17:48:42 +0800256 __entry->dirty = is_sbi_flag_set(F2FS_SB(sb), SBI_IS_DIRTY);
Namjae Jeona2a4a7e2013-04-20 01:28:40 +0900257 __entry->wait = wait;
258 ),
259
260 TP_printk("dev = (%d,%d), superblock is %s, wait = %d",
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -0800261 show_dev(__entry->dev),
Namjae Jeona2a4a7e2013-04-20 01:28:40 +0900262 __entry->dirty ? "dirty" : "not dirty",
263 __entry->wait)
264);
265
266DEFINE_EVENT(f2fs__inode, f2fs_iget,
267
268 TP_PROTO(struct inode *inode),
269
270 TP_ARGS(inode)
271);
272
273DEFINE_EVENT(f2fs__inode_exit, f2fs_iget_exit,
274
275 TP_PROTO(struct inode *inode, int ret),
276
277 TP_ARGS(inode, ret)
278);
279
280DEFINE_EVENT(f2fs__inode, f2fs_evict_inode,
281
282 TP_PROTO(struct inode *inode),
283
284 TP_ARGS(inode)
285);
286
Jaegeuk Kimd70b4f52013-04-25 13:24:33 +0900287DEFINE_EVENT(f2fs__inode_exit, f2fs_new_inode,
288
289 TP_PROTO(struct inode *inode, int ret),
290
291 TP_ARGS(inode, ret)
292);
293
Namjae Jeona2a4a7e2013-04-20 01:28:40 +0900294TRACE_EVENT(f2fs_unlink_enter,
295
296 TP_PROTO(struct inode *dir, struct dentry *dentry),
297
298 TP_ARGS(dir, dentry),
299
300 TP_STRUCT__entry(
301 __field(dev_t, dev)
302 __field(ino_t, ino)
303 __field(loff_t, size)
304 __field(blkcnt_t, blocks)
305 __field(const char *, name)
306 ),
307
308 TP_fast_assign(
309 __entry->dev = dir->i_sb->s_dev;
310 __entry->ino = dir->i_ino;
311 __entry->size = dir->i_size;
312 __entry->blocks = dir->i_blocks;
313 __entry->name = dentry->d_name.name;
314 ),
315
316 TP_printk("dev = (%d,%d), dir ino = %lu, i_size = %lld, "
317 "i_blocks = %llu, name = %s",
318 show_dev_ino(__entry),
319 __entry->size,
320 (unsigned long long)__entry->blocks,
321 __entry->name)
322);
323
324DEFINE_EVENT(f2fs__inode_exit, f2fs_unlink_exit,
325
326 TP_PROTO(struct inode *inode, int ret),
327
328 TP_ARGS(inode, ret)
329);
Namjae Jeon51dd6242013-04-20 01:28:52 +0900330
Hou Pengyangb8d96a32017-02-27 13:02:58 +0000331DEFINE_EVENT(f2fs__inode_exit, f2fs_drop_inode,
332
333 TP_PROTO(struct inode *inode, int ret),
334
335 TP_ARGS(inode, ret)
336);
337
Namjae Jeon51dd6242013-04-20 01:28:52 +0900338DEFINE_EVENT(f2fs__inode, f2fs_truncate,
339
340 TP_PROTO(struct inode *inode),
341
342 TP_ARGS(inode)
343);
344
345TRACE_EVENT(f2fs_truncate_data_blocks_range,
346
347 TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs, int free),
348
349 TP_ARGS(inode, nid, ofs, free),
350
351 TP_STRUCT__entry(
352 __field(dev_t, dev)
353 __field(ino_t, ino)
354 __field(nid_t, nid)
355 __field(unsigned int, ofs)
356 __field(int, free)
357 ),
358
359 TP_fast_assign(
360 __entry->dev = inode->i_sb->s_dev;
361 __entry->ino = inode->i_ino;
362 __entry->nid = nid;
363 __entry->ofs = ofs;
364 __entry->free = free;
365 ),
366
367 TP_printk("dev = (%d,%d), ino = %lu, nid = %u, offset = %u, freed = %d",
368 show_dev_ino(__entry),
369 (unsigned int)__entry->nid,
370 __entry->ofs,
371 __entry->free)
372);
373
374DECLARE_EVENT_CLASS(f2fs__truncate_op,
375
376 TP_PROTO(struct inode *inode, u64 from),
377
378 TP_ARGS(inode, from),
379
380 TP_STRUCT__entry(
381 __field(dev_t, dev)
382 __field(ino_t, ino)
383 __field(loff_t, size)
384 __field(blkcnt_t, blocks)
385 __field(u64, from)
386 ),
387
388 TP_fast_assign(
389 __entry->dev = inode->i_sb->s_dev;
390 __entry->ino = inode->i_ino;
391 __entry->size = inode->i_size;
392 __entry->blocks = inode->i_blocks;
393 __entry->from = from;
394 ),
395
396 TP_printk("dev = (%d,%d), ino = %lu, i_size = %lld, i_blocks = %llu, "
397 "start file offset = %llu",
398 show_dev_ino(__entry),
399 __entry->size,
400 (unsigned long long)__entry->blocks,
401 (unsigned long long)__entry->from)
402);
403
404DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_blocks_enter,
405
406 TP_PROTO(struct inode *inode, u64 from),
407
408 TP_ARGS(inode, from)
409);
410
411DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_blocks_exit,
412
413 TP_PROTO(struct inode *inode, int ret),
414
415 TP_ARGS(inode, ret)
416);
417
418DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_inode_blocks_enter,
419
420 TP_PROTO(struct inode *inode, u64 from),
421
422 TP_ARGS(inode, from)
423);
424
425DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_inode_blocks_exit,
426
427 TP_PROTO(struct inode *inode, int ret),
428
429 TP_ARGS(inode, ret)
430);
431
432DECLARE_EVENT_CLASS(f2fs__truncate_node,
433
434 TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
435
436 TP_ARGS(inode, nid, blk_addr),
437
438 TP_STRUCT__entry(
439 __field(dev_t, dev)
440 __field(ino_t, ino)
441 __field(nid_t, nid)
442 __field(block_t, blk_addr)
443 ),
444
445 TP_fast_assign(
446 __entry->dev = inode->i_sb->s_dev;
447 __entry->ino = inode->i_ino;
448 __entry->nid = nid;
449 __entry->blk_addr = blk_addr;
450 ),
451
452 TP_printk("dev = (%d,%d), ino = %lu, nid = %u, block_address = 0x%llx",
453 show_dev_ino(__entry),
454 (unsigned int)__entry->nid,
455 (unsigned long long)__entry->blk_addr)
456);
457
458DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_nodes_enter,
459
460 TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
461
462 TP_ARGS(inode, nid, blk_addr)
463);
464
465DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_nodes_exit,
466
467 TP_PROTO(struct inode *inode, int ret),
468
469 TP_ARGS(inode, ret)
470);
471
472DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_node,
473
474 TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
475
476 TP_ARGS(inode, nid, blk_addr)
477);
478
479TRACE_EVENT(f2fs_truncate_partial_nodes,
480
481 TP_PROTO(struct inode *inode, nid_t nid[], int depth, int err),
482
483 TP_ARGS(inode, nid, depth, err),
484
485 TP_STRUCT__entry(
486 __field(dev_t, dev)
487 __field(ino_t, ino)
488 __field(nid_t, nid[3])
489 __field(int, depth)
490 __field(int, err)
491 ),
492
493 TP_fast_assign(
494 __entry->dev = inode->i_sb->s_dev;
495 __entry->ino = inode->i_ino;
496 __entry->nid[0] = nid[0];
497 __entry->nid[1] = nid[1];
498 __entry->nid[2] = nid[2];
499 __entry->depth = depth;
500 __entry->err = err;
501 ),
502
503 TP_printk("dev = (%d,%d), ino = %lu, "
504 "nid[0] = %u, nid[1] = %u, nid[2] = %u, depth = %d, err = %d",
505 show_dev_ino(__entry),
506 (unsigned int)__entry->nid[0],
507 (unsigned int)__entry->nid[1],
508 (unsigned int)__entry->nid[2],
509 __entry->depth,
510 __entry->err)
511);
512
Jaegeuk Kim003a3e12015-04-06 19:55:34 -0700513TRACE_EVENT(f2fs_map_blocks,
514 TP_PROTO(struct inode *inode, struct f2fs_map_blocks *map, int ret),
Namjae Jeon848753a2013-04-23 16:38:02 +0900515
Jaegeuk Kim003a3e12015-04-06 19:55:34 -0700516 TP_ARGS(inode, map, ret),
Namjae Jeon848753a2013-04-23 16:38:02 +0900517
518 TP_STRUCT__entry(
519 __field(dev_t, dev)
520 __field(ino_t, ino)
Jaegeuk Kim003a3e12015-04-06 19:55:34 -0700521 __field(block_t, m_lblk)
522 __field(block_t, m_pblk)
523 __field(unsigned int, m_len)
Namjae Jeon848753a2013-04-23 16:38:02 +0900524 __field(int, ret)
525 ),
526
527 TP_fast_assign(
528 __entry->dev = inode->i_sb->s_dev;
529 __entry->ino = inode->i_ino;
Jaegeuk Kim003a3e12015-04-06 19:55:34 -0700530 __entry->m_lblk = map->m_lblk;
531 __entry->m_pblk = map->m_pblk;
532 __entry->m_len = map->m_len;
Namjae Jeon848753a2013-04-23 16:38:02 +0900533 __entry->ret = ret;
534 ),
535
536 TP_printk("dev = (%d,%d), ino = %lu, file offset = %llu, "
Jaegeuk Kim003a3e12015-04-06 19:55:34 -0700537 "start blkaddr = 0x%llx, len = 0x%llx, err = %d",
Namjae Jeon848753a2013-04-23 16:38:02 +0900538 show_dev_ino(__entry),
Jaegeuk Kim003a3e12015-04-06 19:55:34 -0700539 (unsigned long long)__entry->m_lblk,
540 (unsigned long long)__entry->m_pblk,
541 (unsigned long long)__entry->m_len,
Namjae Jeon848753a2013-04-23 16:38:02 +0900542 __entry->ret)
543);
544
Jaegeuk Kim5c267432015-10-05 11:32:34 -0700545TRACE_EVENT(f2fs_background_gc,
546
Chao Yub8c502b2017-08-07 23:12:46 +0800547 TP_PROTO(struct super_block *sb, unsigned int wait_ms,
Jaegeuk Kim5c267432015-10-05 11:32:34 -0700548 unsigned int prefree, unsigned int free),
549
550 TP_ARGS(sb, wait_ms, prefree, free),
551
552 TP_STRUCT__entry(
553 __field(dev_t, dev)
Chao Yub8c502b2017-08-07 23:12:46 +0800554 __field(unsigned int, wait_ms)
Jaegeuk Kim5c267432015-10-05 11:32:34 -0700555 __field(unsigned int, prefree)
556 __field(unsigned int, free)
557 ),
558
559 TP_fast_assign(
560 __entry->dev = sb->s_dev;
561 __entry->wait_ms = wait_ms;
562 __entry->prefree = prefree;
563 __entry->free = free;
564 ),
565
Chao Yub8c502b2017-08-07 23:12:46 +0800566 TP_printk("dev = (%d,%d), wait_ms = %u, prefree = %u, free = %u",
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -0800567 show_dev(__entry->dev),
Jaegeuk Kim5c267432015-10-05 11:32:34 -0700568 __entry->wait_ms,
569 __entry->prefree,
570 __entry->free)
571);
572
Chao Yuc56f16d2017-08-11 18:00:15 +0800573TRACE_EVENT(f2fs_gc_begin,
574
575 TP_PROTO(struct super_block *sb, bool sync, bool background,
576 long long dirty_nodes, long long dirty_dents,
577 long long dirty_imeta, unsigned int free_sec,
578 unsigned int free_seg, int reserved_seg,
579 unsigned int prefree_seg),
580
581 TP_ARGS(sb, sync, background, dirty_nodes, dirty_dents, dirty_imeta,
582 free_sec, free_seg, reserved_seg, prefree_seg),
583
584 TP_STRUCT__entry(
585 __field(dev_t, dev)
586 __field(bool, sync)
587 __field(bool, background)
588 __field(long long, dirty_nodes)
589 __field(long long, dirty_dents)
590 __field(long long, dirty_imeta)
591 __field(unsigned int, free_sec)
592 __field(unsigned int, free_seg)
593 __field(int, reserved_seg)
594 __field(unsigned int, prefree_seg)
595 ),
596
597 TP_fast_assign(
598 __entry->dev = sb->s_dev;
599 __entry->sync = sync;
600 __entry->background = background;
601 __entry->dirty_nodes = dirty_nodes;
602 __entry->dirty_dents = dirty_dents;
603 __entry->dirty_imeta = dirty_imeta;
604 __entry->free_sec = free_sec;
605 __entry->free_seg = free_seg;
606 __entry->reserved_seg = reserved_seg;
607 __entry->prefree_seg = prefree_seg;
608 ),
609
610 TP_printk("dev = (%d,%d), sync = %d, background = %d, nodes = %lld, "
611 "dents = %lld, imeta = %lld, free_sec:%u, free_seg:%u, "
612 "rsv_seg:%d, prefree_seg:%u",
613 show_dev(__entry->dev),
614 __entry->sync,
615 __entry->background,
616 __entry->dirty_nodes,
617 __entry->dirty_dents,
618 __entry->dirty_imeta,
619 __entry->free_sec,
620 __entry->free_seg,
621 __entry->reserved_seg,
622 __entry->prefree_seg)
623);
624
625TRACE_EVENT(f2fs_gc_end,
626
627 TP_PROTO(struct super_block *sb, int ret, int seg_freed,
628 int sec_freed, long long dirty_nodes,
629 long long dirty_dents, long long dirty_imeta,
630 unsigned int free_sec, unsigned int free_seg,
631 int reserved_seg, unsigned int prefree_seg),
632
633 TP_ARGS(sb, ret, seg_freed, sec_freed, dirty_nodes, dirty_dents,
634 dirty_imeta, free_sec, free_seg, reserved_seg, prefree_seg),
635
636 TP_STRUCT__entry(
637 __field(dev_t, dev)
638 __field(int, ret)
639 __field(int, seg_freed)
640 __field(int, sec_freed)
641 __field(long long, dirty_nodes)
642 __field(long long, dirty_dents)
643 __field(long long, dirty_imeta)
644 __field(unsigned int, free_sec)
645 __field(unsigned int, free_seg)
646 __field(int, reserved_seg)
647 __field(unsigned int, prefree_seg)
648 ),
649
650 TP_fast_assign(
651 __entry->dev = sb->s_dev;
652 __entry->ret = ret;
653 __entry->seg_freed = seg_freed;
654 __entry->sec_freed = sec_freed;
655 __entry->dirty_nodes = dirty_nodes;
656 __entry->dirty_dents = dirty_dents;
657 __entry->dirty_imeta = dirty_imeta;
658 __entry->free_sec = free_sec;
659 __entry->free_seg = free_seg;
660 __entry->reserved_seg = reserved_seg;
661 __entry->prefree_seg = prefree_seg;
662 ),
663
664 TP_printk("dev = (%d,%d), ret = %d, seg_freed = %d, sec_freed = %d, "
665 "nodes = %lld, dents = %lld, imeta = %lld, free_sec:%u, "
666 "free_seg:%u, rsv_seg:%d, prefree_seg:%u",
667 show_dev(__entry->dev),
668 __entry->ret,
669 __entry->seg_freed,
670 __entry->sec_freed,
671 __entry->dirty_nodes,
672 __entry->dirty_dents,
673 __entry->dirty_imeta,
674 __entry->free_sec,
675 __entry->free_seg,
676 __entry->reserved_seg,
677 __entry->prefree_seg)
678);
679
Namjae Jeon8e46b3e2013-04-23 16:42:53 +0900680TRACE_EVENT(f2fs_get_victim,
681
682 TP_PROTO(struct super_block *sb, int type, int gc_type,
683 struct victim_sel_policy *p, unsigned int pre_victim,
684 unsigned int prefree, unsigned int free),
685
686 TP_ARGS(sb, type, gc_type, p, pre_victim, prefree, free),
687
688 TP_STRUCT__entry(
689 __field(dev_t, dev)
690 __field(int, type)
691 __field(int, gc_type)
692 __field(int, alloc_mode)
693 __field(int, gc_mode)
694 __field(unsigned int, victim)
Jaegeuk Kim5012de22017-02-16 10:35:41 -0800695 __field(unsigned int, cost)
Namjae Jeon8e46b3e2013-04-23 16:42:53 +0900696 __field(unsigned int, ofs_unit)
697 __field(unsigned int, pre_victim)
698 __field(unsigned int, prefree)
699 __field(unsigned int, free)
700 ),
701
702 TP_fast_assign(
703 __entry->dev = sb->s_dev;
704 __entry->type = type;
705 __entry->gc_type = gc_type;
706 __entry->alloc_mode = p->alloc_mode;
707 __entry->gc_mode = p->gc_mode;
708 __entry->victim = p->min_segno;
Jaegeuk Kim5012de22017-02-16 10:35:41 -0800709 __entry->cost = p->min_cost;
Namjae Jeon8e46b3e2013-04-23 16:42:53 +0900710 __entry->ofs_unit = p->ofs_unit;
711 __entry->pre_victim = pre_victim;
712 __entry->prefree = prefree;
713 __entry->free = free;
714 ),
715
Jaegeuk Kim5012de22017-02-16 10:35:41 -0800716 TP_printk("dev = (%d,%d), type = %s, policy = (%s, %s, %s), "
717 "victim = %u, cost = %u, ofs_unit = %u, "
718 "pre_victim_secno = %d, prefree = %u, free = %u",
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -0800719 show_dev(__entry->dev),
Namjae Jeon8e46b3e2013-04-23 16:42:53 +0900720 show_data_type(__entry->type),
721 show_gc_type(__entry->gc_type),
722 show_alloc_mode(__entry->alloc_mode),
723 show_victim_policy(__entry->gc_mode),
724 __entry->victim,
Jaegeuk Kim5012de22017-02-16 10:35:41 -0800725 __entry->cost,
Namjae Jeon8e46b3e2013-04-23 16:42:53 +0900726 __entry->ofs_unit,
727 (int)__entry->pre_victim,
728 __entry->prefree,
729 __entry->free)
730);
731
Namjae Jeonc01e2852013-04-23 17:00:52 +0900732TRACE_EVENT(f2fs_fallocate,
733
734 TP_PROTO(struct inode *inode, int mode,
735 loff_t offset, loff_t len, int ret),
736
737 TP_ARGS(inode, mode, offset, len, ret),
738
739 TP_STRUCT__entry(
740 __field(dev_t, dev)
741 __field(ino_t, ino)
742 __field(int, mode)
743 __field(loff_t, offset)
744 __field(loff_t, len)
745 __field(loff_t, size)
746 __field(blkcnt_t, blocks)
747 __field(int, ret)
748 ),
749
750 TP_fast_assign(
751 __entry->dev = inode->i_sb->s_dev;
752 __entry->ino = inode->i_ino;
753 __entry->mode = mode;
754 __entry->offset = offset;
755 __entry->len = len;
756 __entry->size = inode->i_size;
757 __entry->blocks = inode->i_blocks;
758 __entry->ret = ret;
759 ),
760
761 TP_printk("dev = (%d,%d), ino = %lu, mode = %x, offset = %lld, "
762 "len = %lld, i_size = %lld, i_blocks = %llu, ret = %d",
763 show_dev_ino(__entry),
764 __entry->mode,
765 (unsigned long long)__entry->offset,
766 (unsigned long long)__entry->len,
767 (unsigned long long)__entry->size,
768 (unsigned long long)__entry->blocks,
769 __entry->ret)
770);
771
Chao Yu70407fad2014-07-31 21:11:22 +0800772TRACE_EVENT(f2fs_direct_IO_enter,
773
774 TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw),
775
776 TP_ARGS(inode, offset, len, rw),
777
778 TP_STRUCT__entry(
779 __field(dev_t, dev)
780 __field(ino_t, ino)
781 __field(loff_t, pos)
782 __field(unsigned long, len)
783 __field(int, rw)
784 ),
785
786 TP_fast_assign(
787 __entry->dev = inode->i_sb->s_dev;
788 __entry->ino = inode->i_ino;
789 __entry->pos = offset;
790 __entry->len = len;
791 __entry->rw = rw;
792 ),
793
794 TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu rw = %d",
795 show_dev_ino(__entry),
796 __entry->pos,
797 __entry->len,
798 __entry->rw)
799);
800
801TRACE_EVENT(f2fs_direct_IO_exit,
802
803 TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
804 int rw, int ret),
805
806 TP_ARGS(inode, offset, len, rw, ret),
807
808 TP_STRUCT__entry(
809 __field(dev_t, dev)
810 __field(ino_t, ino)
811 __field(loff_t, pos)
812 __field(unsigned long, len)
813 __field(int, rw)
814 __field(int, ret)
815 ),
816
817 TP_fast_assign(
818 __entry->dev = inode->i_sb->s_dev;
819 __entry->ino = inode->i_ino;
820 __entry->pos = offset;
821 __entry->len = len;
822 __entry->rw = rw;
823 __entry->ret = ret;
824 ),
825
826 TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu "
827 "rw = %d ret = %d",
828 show_dev_ino(__entry),
829 __entry->pos,
830 __entry->len,
831 __entry->rw,
832 __entry->ret)
833);
834
Chao Yu46008c62016-05-09 19:56:30 +0800835TRACE_EVENT(f2fs_reserve_new_blocks,
Namjae Jeonc01e2852013-04-23 17:00:52 +0900836
Chao Yu46008c62016-05-09 19:56:30 +0800837 TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs_in_node,
838 blkcnt_t count),
Namjae Jeonc01e2852013-04-23 17:00:52 +0900839
Chao Yu46008c62016-05-09 19:56:30 +0800840 TP_ARGS(inode, nid, ofs_in_node, count),
Namjae Jeonc01e2852013-04-23 17:00:52 +0900841
842 TP_STRUCT__entry(
843 __field(dev_t, dev)
844 __field(nid_t, nid)
845 __field(unsigned int, ofs_in_node)
Chao Yu46008c62016-05-09 19:56:30 +0800846 __field(blkcnt_t, count)
Namjae Jeonc01e2852013-04-23 17:00:52 +0900847 ),
848
849 TP_fast_assign(
850 __entry->dev = inode->i_sb->s_dev;
851 __entry->nid = nid;
852 __entry->ofs_in_node = ofs_in_node;
Chao Yu46008c62016-05-09 19:56:30 +0800853 __entry->count = count;
Namjae Jeonc01e2852013-04-23 17:00:52 +0900854 ),
855
Chao Yu46008c62016-05-09 19:56:30 +0800856 TP_printk("dev = (%d,%d), nid = %u, ofs_in_node = %u, count = %llu",
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -0800857 show_dev(__entry->dev),
Namjae Jeonc01e2852013-04-23 17:00:52 +0900858 (unsigned int)__entry->nid,
Chao Yu46008c62016-05-09 19:56:30 +0800859 __entry->ofs_in_node,
860 (unsigned long long)__entry->count)
Namjae Jeonc01e2852013-04-23 17:00:52 +0900861);
862
Chao Yu3e1c8f12014-12-23 16:35:21 +0800863DECLARE_EVENT_CLASS(f2fs__submit_page_bio,
864
Chao Yu2ace38e2014-12-24 16:08:14 +0800865 TP_PROTO(struct page *page, struct f2fs_io_info *fio),
Chao Yu3e1c8f12014-12-23 16:35:21 +0800866
Chao Yu2ace38e2014-12-24 16:08:14 +0800867 TP_ARGS(page, fio),
Chao Yu3e1c8f12014-12-23 16:35:21 +0800868
869 TP_STRUCT__entry(
870 __field(dev_t, dev)
871 __field(ino_t, ino)
872 __field(pgoff_t, index)
Chao Yu7a9d7542016-02-22 18:36:38 +0800873 __field(block_t, old_blkaddr)
874 __field(block_t, new_blkaddr)
Mike Christie04d328d2016-06-05 14:31:55 -0500875 __field(int, op)
876 __field(int, op_flags)
Jaegeuk Kima912b542017-05-10 11:18:25 -0700877 __field(int, temp)
Chao Yu3e1c8f12014-12-23 16:35:21 +0800878 __field(int, type)
879 ),
880
881 TP_fast_assign(
882 __entry->dev = page->mapping->host->i_sb->s_dev;
883 __entry->ino = page->mapping->host->i_ino;
884 __entry->index = page->index;
Chao Yu7a9d7542016-02-22 18:36:38 +0800885 __entry->old_blkaddr = fio->old_blkaddr;
886 __entry->new_blkaddr = fio->new_blkaddr;
Mike Christie04d328d2016-06-05 14:31:55 -0500887 __entry->op = fio->op;
888 __entry->op_flags = fio->op_flags;
Jaegeuk Kima912b542017-05-10 11:18:25 -0700889 __entry->temp = fio->temp;
Chao Yu2ace38e2014-12-24 16:08:14 +0800890 __entry->type = fio->type;
Chao Yu3e1c8f12014-12-23 16:35:21 +0800891 ),
892
893 TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, "
Jaegeuk Kima912b542017-05-10 11:18:25 -0700894 "oldaddr = 0x%llx, newaddr = 0x%llx, rw = %s(%s), type = %s_%s",
Chao Yu3e1c8f12014-12-23 16:35:21 +0800895 show_dev_ino(__entry),
896 (unsigned long)__entry->index,
Chao Yu7a9d7542016-02-22 18:36:38 +0800897 (unsigned long long)__entry->old_blkaddr,
898 (unsigned long long)__entry->new_blkaddr,
Jaegeuk Kimd621e6b2016-12-21 14:26:39 -0800899 show_bio_type(__entry->op, __entry->op_flags),
Jaegeuk Kima912b542017-05-10 11:18:25 -0700900 show_block_temp(__entry->temp),
Chao Yu3e1c8f12014-12-23 16:35:21 +0800901 show_block_type(__entry->type))
902);
903
904DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_bio,
905
Chao Yu2ace38e2014-12-24 16:08:14 +0800906 TP_PROTO(struct page *page, struct f2fs_io_info *fio),
Chao Yu3e1c8f12014-12-23 16:35:21 +0800907
Chao Yu2ace38e2014-12-24 16:08:14 +0800908 TP_ARGS(page, fio),
Chao Yu3e1c8f12014-12-23 16:35:21 +0800909
910 TP_CONDITION(page->mapping)
911);
912
Jaegeuk Kimb9109b02017-05-10 11:28:38 -0700913DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_write,
Chao Yu3e1c8f12014-12-23 16:35:21 +0800914
Chao Yu2ace38e2014-12-24 16:08:14 +0800915 TP_PROTO(struct page *page, struct f2fs_io_info *fio),
Chao Yu3e1c8f12014-12-23 16:35:21 +0800916
Chao Yu2ace38e2014-12-24 16:08:14 +0800917 TP_ARGS(page, fio),
Chao Yu3e1c8f12014-12-23 16:35:21 +0800918
919 TP_CONDITION(page->mapping)
920);
921
Jaegeuk Kim554b5122016-12-21 12:13:03 -0800922DECLARE_EVENT_CLASS(f2fs__bio,
Namjae Jeon6ec178d2013-04-23 17:51:43 +0900923
Jaegeuk Kim554b5122016-12-21 12:13:03 -0800924 TP_PROTO(struct super_block *sb, int type, struct bio *bio),
Namjae Jeon6ec178d2013-04-23 17:51:43 +0900925
Jaegeuk Kim554b5122016-12-21 12:13:03 -0800926 TP_ARGS(sb, type, bio),
Namjae Jeon6ec178d2013-04-23 17:51:43 +0900927
928 TP_STRUCT__entry(
929 __field(dev_t, dev)
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -0800930 __field(dev_t, target)
Mike Christie04d328d2016-06-05 14:31:55 -0500931 __field(int, op)
932 __field(int, op_flags)
Chao Yud4d288b2013-11-24 12:36:42 +0900933 __field(int, type)
Namjae Jeon6ec178d2013-04-23 17:51:43 +0900934 __field(sector_t, sector)
935 __field(unsigned int, size)
936 ),
937
938 TP_fast_assign(
939 __entry->dev = sb->s_dev;
Christoph Hellwig74d46992017-08-23 19:10:32 +0200940 __entry->target = bio_dev(bio);
Jaegeuk Kim554b5122016-12-21 12:13:03 -0800941 __entry->op = bio_op(bio);
942 __entry->op_flags = bio->bi_opf;
943 __entry->type = type;
Kent Overstreet4f024f32013-10-11 15:44:27 -0700944 __entry->sector = bio->bi_iter.bi_sector;
945 __entry->size = bio->bi_iter.bi_size;
Namjae Jeon6ec178d2013-04-23 17:51:43 +0900946 ),
947
Chao Yubaaabbb2017-05-04 09:35:43 +0800948 TP_printk("dev = (%d,%d)/(%d,%d), rw = %s(%s), %s, sector = %lld, size = %u",
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -0800949 show_dev(__entry->target),
950 show_dev(__entry->dev),
Jaegeuk Kimd621e6b2016-12-21 14:26:39 -0800951 show_bio_type(__entry->op, __entry->op_flags),
Chao Yud4d288b2013-11-24 12:36:42 +0900952 show_block_type(__entry->type),
Namjae Jeon6ec178d2013-04-23 17:51:43 +0900953 (unsigned long long)__entry->sector,
954 __entry->size)
955);
956
Jaegeuk Kim554b5122016-12-21 12:13:03 -0800957DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_prepare_write_bio,
Chao Yud4d288b2013-11-24 12:36:42 +0900958
Jaegeuk Kim554b5122016-12-21 12:13:03 -0800959 TP_PROTO(struct super_block *sb, int type, struct bio *bio),
Chao Yud4d288b2013-11-24 12:36:42 +0900960
Jaegeuk Kim554b5122016-12-21 12:13:03 -0800961 TP_ARGS(sb, type, bio),
Jaegeuk Kim93dfe2a2013-11-30 12:51:14 +0900962
963 TP_CONDITION(bio)
Chao Yud4d288b2013-11-24 12:36:42 +0900964);
965
Jaegeuk Kim554b5122016-12-21 12:13:03 -0800966DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_prepare_read_bio,
Chao Yud4d288b2013-11-24 12:36:42 +0900967
Jaegeuk Kim554b5122016-12-21 12:13:03 -0800968 TP_PROTO(struct super_block *sb, int type, struct bio *bio),
Chao Yud4d288b2013-11-24 12:36:42 +0900969
Jaegeuk Kim554b5122016-12-21 12:13:03 -0800970 TP_ARGS(sb, type, bio),
971
972 TP_CONDITION(bio)
973);
974
975DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_read_bio,
976
977 TP_PROTO(struct super_block *sb, int type, struct bio *bio),
978
979 TP_ARGS(sb, type, bio),
980
981 TP_CONDITION(bio)
982);
983
984DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_write_bio,
985
986 TP_PROTO(struct super_block *sb, int type, struct bio *bio),
987
988 TP_ARGS(sb, type, bio),
Jaegeuk Kim93dfe2a2013-11-30 12:51:14 +0900989
990 TP_CONDITION(bio)
Chao Yud4d288b2013-11-24 12:36:42 +0900991);
992
Chao Yu62aed042014-05-06 16:46:04 +0800993TRACE_EVENT(f2fs_write_begin,
994
995 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
996 unsigned int flags),
997
998 TP_ARGS(inode, pos, len, flags),
999
1000 TP_STRUCT__entry(
1001 __field(dev_t, dev)
1002 __field(ino_t, ino)
1003 __field(loff_t, pos)
1004 __field(unsigned int, len)
1005 __field(unsigned int, flags)
1006 ),
1007
1008 TP_fast_assign(
1009 __entry->dev = inode->i_sb->s_dev;
1010 __entry->ino = inode->i_ino;
1011 __entry->pos = pos;
1012 __entry->len = len;
1013 __entry->flags = flags;
1014 ),
1015
1016 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, flags = %u",
1017 show_dev_ino(__entry),
1018 (unsigned long long)__entry->pos,
1019 __entry->len,
1020 __entry->flags)
1021);
1022
Chao Yudfb2bf32014-05-06 16:47:23 +08001023TRACE_EVENT(f2fs_write_end,
1024
1025 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
1026 unsigned int copied),
1027
1028 TP_ARGS(inode, pos, len, copied),
1029
1030 TP_STRUCT__entry(
1031 __field(dev_t, dev)
1032 __field(ino_t, ino)
1033 __field(loff_t, pos)
1034 __field(unsigned int, len)
1035 __field(unsigned int, copied)
1036 ),
1037
1038 TP_fast_assign(
1039 __entry->dev = inode->i_sb->s_dev;
1040 __entry->ino = inode->i_ino;
1041 __entry->pos = pos;
1042 __entry->len = len;
1043 __entry->copied = copied;
1044 ),
1045
1046 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, copied = %u",
1047 show_dev_ino(__entry),
1048 (unsigned long long)__entry->pos,
1049 __entry->len,
1050 __entry->copied)
1051);
1052
Jaegeuk Kim26c6b882013-10-24 17:53:29 +09001053DECLARE_EVENT_CLASS(f2fs__page,
1054
1055 TP_PROTO(struct page *page, int type),
1056
1057 TP_ARGS(page, type),
1058
1059 TP_STRUCT__entry(
1060 __field(dev_t, dev)
1061 __field(ino_t, ino)
1062 __field(int, type)
1063 __field(int, dir)
1064 __field(pgoff_t, index)
1065 __field(int, dirty)
Chao Yuc20e89c2014-05-06 16:53:08 +08001066 __field(int, uptodate)
Jaegeuk Kim26c6b882013-10-24 17:53:29 +09001067 ),
1068
1069 TP_fast_assign(
1070 __entry->dev = page->mapping->host->i_sb->s_dev;
1071 __entry->ino = page->mapping->host->i_ino;
1072 __entry->type = type;
1073 __entry->dir = S_ISDIR(page->mapping->host->i_mode);
1074 __entry->index = page->index;
1075 __entry->dirty = PageDirty(page);
Chao Yuc20e89c2014-05-06 16:53:08 +08001076 __entry->uptodate = PageUptodate(page);
Jaegeuk Kim26c6b882013-10-24 17:53:29 +09001077 ),
1078
Chao Yuc20e89c2014-05-06 16:53:08 +08001079 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, "
1080 "dirty = %d, uptodate = %d",
Jaegeuk Kim26c6b882013-10-24 17:53:29 +09001081 show_dev_ino(__entry),
1082 show_block_type(__entry->type),
1083 show_file_type(__entry->dir),
1084 (unsigned long)__entry->index,
Chao Yuc20e89c2014-05-06 16:53:08 +08001085 __entry->dirty,
1086 __entry->uptodate)
Jaegeuk Kim26c6b882013-10-24 17:53:29 +09001087);
1088
Chao Yuecda0de2014-05-06 16:48:26 +08001089DEFINE_EVENT(f2fs__page, f2fs_writepage,
1090
1091 TP_PROTO(struct page *page, int type),
1092
1093 TP_ARGS(page, type)
1094);
1095
Jaegeuk Kim8ce67cb2015-03-17 17:58:08 -07001096DEFINE_EVENT(f2fs__page, f2fs_do_write_data_page,
1097
1098 TP_PROTO(struct page *page, int type),
1099
1100 TP_ARGS(page, type)
1101);
1102
Chao Yuc20e89c2014-05-06 16:53:08 +08001103DEFINE_EVENT(f2fs__page, f2fs_readpage,
1104
1105 TP_PROTO(struct page *page, int type),
1106
1107 TP_ARGS(page, type)
1108);
1109
Jaegeuk Kim26c6b882013-10-24 17:53:29 +09001110DEFINE_EVENT(f2fs__page, f2fs_set_page_dirty,
1111
1112 TP_PROTO(struct page *page, int type),
1113
1114 TP_ARGS(page, type)
1115);
1116
Jaegeuk Kime943a102013-10-25 14:26:31 +09001117DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite,
1118
1119 TP_PROTO(struct page *page, int type),
1120
1121 TP_ARGS(page, type)
1122);
1123
Jaegeuk Kim8ce67cb2015-03-17 17:58:08 -07001124DEFINE_EVENT(f2fs__page, f2fs_register_inmem_page,
1125
1126 TP_PROTO(struct page *page, int type),
1127
1128 TP_ARGS(page, type)
1129);
1130
1131DEFINE_EVENT(f2fs__page, f2fs_commit_inmem_page,
1132
1133 TP_PROTO(struct page *page, int type),
1134
1135 TP_ARGS(page, type)
1136);
1137
Chao Yue5748432014-05-06 16:51:24 +08001138TRACE_EVENT(f2fs_writepages,
1139
1140 TP_PROTO(struct inode *inode, struct writeback_control *wbc, int type),
1141
1142 TP_ARGS(inode, wbc, type),
1143
1144 TP_STRUCT__entry(
1145 __field(dev_t, dev)
1146 __field(ino_t, ino)
1147 __field(int, type)
1148 __field(int, dir)
1149 __field(long, nr_to_write)
1150 __field(long, pages_skipped)
1151 __field(loff_t, range_start)
1152 __field(loff_t, range_end)
1153 __field(pgoff_t, writeback_index)
1154 __field(int, sync_mode)
1155 __field(char, for_kupdate)
1156 __field(char, for_background)
1157 __field(char, tagged_writepages)
1158 __field(char, for_reclaim)
1159 __field(char, range_cyclic)
1160 __field(char, for_sync)
1161 ),
1162
1163 TP_fast_assign(
1164 __entry->dev = inode->i_sb->s_dev;
1165 __entry->ino = inode->i_ino;
1166 __entry->type = type;
1167 __entry->dir = S_ISDIR(inode->i_mode);
1168 __entry->nr_to_write = wbc->nr_to_write;
1169 __entry->pages_skipped = wbc->pages_skipped;
1170 __entry->range_start = wbc->range_start;
1171 __entry->range_end = wbc->range_end;
1172 __entry->writeback_index = inode->i_mapping->writeback_index;
1173 __entry->sync_mode = wbc->sync_mode;
1174 __entry->for_kupdate = wbc->for_kupdate;
1175 __entry->for_background = wbc->for_background;
1176 __entry->tagged_writepages = wbc->tagged_writepages;
1177 __entry->for_reclaim = wbc->for_reclaim;
1178 __entry->range_cyclic = wbc->range_cyclic;
1179 __entry->for_sync = wbc->for_sync;
1180 ),
1181
1182 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, "
1183 "skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, "
1184 "kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u",
1185 show_dev_ino(__entry),
1186 show_block_type(__entry->type),
1187 show_file_type(__entry->dir),
1188 __entry->nr_to_write,
1189 __entry->pages_skipped,
1190 __entry->range_start,
1191 __entry->range_end,
1192 (unsigned long)__entry->writeback_index,
1193 __entry->sync_mode,
1194 __entry->for_kupdate,
1195 __entry->for_background,
1196 __entry->tagged_writepages,
1197 __entry->for_reclaim,
1198 __entry->range_cyclic,
1199 __entry->for_sync)
1200);
1201
Chao Yub8c29402015-10-12 17:02:26 +08001202TRACE_EVENT(f2fs_readpages,
1203
1204 TP_PROTO(struct inode *inode, struct page *page, unsigned int nrpage),
1205
1206 TP_ARGS(inode, page, nrpage),
1207
1208 TP_STRUCT__entry(
1209 __field(dev_t, dev)
1210 __field(ino_t, ino)
1211 __field(pgoff_t, start)
1212 __field(unsigned int, nrpage)
1213 ),
1214
1215 TP_fast_assign(
1216 __entry->dev = inode->i_sb->s_dev;
1217 __entry->ino = inode->i_ino;
1218 __entry->start = page->index;
1219 __entry->nrpage = nrpage;
1220 ),
1221
1222 TP_printk("dev = (%d,%d), ino = %lu, start = %lu nrpage = %u",
1223 show_dev_ino(__entry),
1224 (unsigned long)__entry->start,
1225 __entry->nrpage)
1226);
1227
Namjae Jeon2af4bd62013-04-23 18:26:54 +09001228TRACE_EVENT(f2fs_write_checkpoint,
1229
Jaegeuk Kim75ab4cb2014-09-20 21:57:51 -07001230 TP_PROTO(struct super_block *sb, int reason, char *msg),
Namjae Jeon2af4bd62013-04-23 18:26:54 +09001231
Jaegeuk Kim75ab4cb2014-09-20 21:57:51 -07001232 TP_ARGS(sb, reason, msg),
Namjae Jeon2af4bd62013-04-23 18:26:54 +09001233
1234 TP_STRUCT__entry(
1235 __field(dev_t, dev)
Jaegeuk Kim75ab4cb2014-09-20 21:57:51 -07001236 __field(int, reason)
Namjae Jeon2af4bd62013-04-23 18:26:54 +09001237 __field(char *, msg)
1238 ),
1239
1240 TP_fast_assign(
1241 __entry->dev = sb->s_dev;
Jaegeuk Kim75ab4cb2014-09-20 21:57:51 -07001242 __entry->reason = reason;
Namjae Jeon2af4bd62013-04-23 18:26:54 +09001243 __entry->msg = msg;
1244 ),
1245
1246 TP_printk("dev = (%d,%d), checkpoint for %s, state = %s",
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001247 show_dev(__entry->dev),
Jaegeuk Kim75ab4cb2014-09-20 21:57:51 -07001248 show_cpreason(__entry->reason),
Namjae Jeon2af4bd62013-04-23 18:26:54 +09001249 __entry->msg)
1250);
1251
Chao Yu0243a5f2017-04-15 14:09:38 +08001252DECLARE_EVENT_CLASS(f2fs_discard,
Jaegeuk Kim1661d072013-11-12 17:01:00 +09001253
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001254 TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
Jaegeuk Kim1661d072013-11-12 17:01:00 +09001255
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001256 TP_ARGS(dev, blkstart, blklen),
Jaegeuk Kim1661d072013-11-12 17:01:00 +09001257
1258 TP_STRUCT__entry(
1259 __field(dev_t, dev)
1260 __field(block_t, blkstart)
1261 __field(block_t, blklen)
1262 ),
1263
1264 TP_fast_assign(
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001265 __entry->dev = dev->bd_dev;
Jaegeuk Kim1661d072013-11-12 17:01:00 +09001266 __entry->blkstart = blkstart;
1267 __entry->blklen = blklen;
1268 ),
1269
1270 TP_printk("dev = (%d,%d), blkstart = 0x%llx, blklen = 0x%llx",
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001271 show_dev(__entry->dev),
Jaegeuk Kim1661d072013-11-12 17:01:00 +09001272 (unsigned long long)__entry->blkstart,
1273 (unsigned long long)__entry->blklen)
1274);
Jaegeuk Kim24a9ee02014-07-25 17:46:10 -07001275
Chao Yu0243a5f2017-04-15 14:09:38 +08001276DEFINE_EVENT(f2fs_discard, f2fs_queue_discard,
1277
1278 TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
1279
1280 TP_ARGS(dev, blkstart, blklen)
1281);
1282
1283DEFINE_EVENT(f2fs_discard, f2fs_issue_discard,
1284
1285 TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
1286
1287 TP_ARGS(dev, blkstart, blklen)
1288);
1289
Damien Le Moal126606c2016-10-28 17:45:07 +09001290TRACE_EVENT(f2fs_issue_reset_zone,
1291
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001292 TP_PROTO(struct block_device *dev, block_t blkstart),
Damien Le Moal126606c2016-10-28 17:45:07 +09001293
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001294 TP_ARGS(dev, blkstart),
Damien Le Moal126606c2016-10-28 17:45:07 +09001295
1296 TP_STRUCT__entry(
1297 __field(dev_t, dev)
1298 __field(block_t, blkstart)
1299 ),
1300
1301 TP_fast_assign(
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001302 __entry->dev = dev->bd_dev;
Damien Le Moal126606c2016-10-28 17:45:07 +09001303 __entry->blkstart = blkstart;
1304 ),
1305
1306 TP_printk("dev = (%d,%d), reset zone at block = 0x%llx",
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001307 show_dev(__entry->dev),
Damien Le Moal126606c2016-10-28 17:45:07 +09001308 (unsigned long long)__entry->blkstart)
1309);
1310
Jaegeuk Kim24a9ee02014-07-25 17:46:10 -07001311TRACE_EVENT(f2fs_issue_flush,
1312
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001313 TP_PROTO(struct block_device *dev, unsigned int nobarrier,
Kinglong Mee20fda56b2017-03-04 22:13:10 +08001314 unsigned int flush_merge, int ret),
Jaegeuk Kim24a9ee02014-07-25 17:46:10 -07001315
Kinglong Mee20fda56b2017-03-04 22:13:10 +08001316 TP_ARGS(dev, nobarrier, flush_merge, ret),
Jaegeuk Kim24a9ee02014-07-25 17:46:10 -07001317
1318 TP_STRUCT__entry(
1319 __field(dev_t, dev)
Jaegeuk Kim29e70432015-02-10 16:23:12 -08001320 __field(unsigned int, nobarrier)
1321 __field(unsigned int, flush_merge)
Kinglong Mee20fda56b2017-03-04 22:13:10 +08001322 __field(int, ret)
Jaegeuk Kim24a9ee02014-07-25 17:46:10 -07001323 ),
1324
1325 TP_fast_assign(
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001326 __entry->dev = dev->bd_dev;
Jaegeuk Kim24a9ee02014-07-25 17:46:10 -07001327 __entry->nobarrier = nobarrier;
1328 __entry->flush_merge = flush_merge;
Kinglong Mee20fda56b2017-03-04 22:13:10 +08001329 __entry->ret = ret;
Jaegeuk Kim24a9ee02014-07-25 17:46:10 -07001330 ),
1331
Kinglong Mee20fda56b2017-03-04 22:13:10 +08001332 TP_printk("dev = (%d,%d), %s %s, ret = %d",
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001333 show_dev(__entry->dev),
Jaegeuk Kim24a9ee02014-07-25 17:46:10 -07001334 __entry->nobarrier ? "skip (nobarrier)" : "issue",
Kinglong Mee20fda56b2017-03-04 22:13:10 +08001335 __entry->flush_merge ? " with flush_merge" : "",
1336 __entry->ret)
Jaegeuk Kim24a9ee02014-07-25 17:46:10 -07001337);
Chao Yu1ec46102015-02-05 17:59:59 +08001338
1339TRACE_EVENT(f2fs_lookup_extent_tree_start,
1340
1341 TP_PROTO(struct inode *inode, unsigned int pgofs),
1342
1343 TP_ARGS(inode, pgofs),
1344
1345 TP_STRUCT__entry(
1346 __field(dev_t, dev)
1347 __field(ino_t, ino)
1348 __field(unsigned int, pgofs)
1349 ),
1350
1351 TP_fast_assign(
1352 __entry->dev = inode->i_sb->s_dev;
1353 __entry->ino = inode->i_ino;
1354 __entry->pgofs = pgofs;
1355 ),
1356
1357 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u",
1358 show_dev_ino(__entry),
1359 __entry->pgofs)
1360);
1361
1362TRACE_EVENT_CONDITION(f2fs_lookup_extent_tree_end,
1363
1364 TP_PROTO(struct inode *inode, unsigned int pgofs,
Jaegeuk Kim84bc9262015-06-29 16:01:14 -07001365 struct extent_info *ei),
Chao Yu1ec46102015-02-05 17:59:59 +08001366
Jaegeuk Kim84bc9262015-06-29 16:01:14 -07001367 TP_ARGS(inode, pgofs, ei),
Chao Yu1ec46102015-02-05 17:59:59 +08001368
Jaegeuk Kim84bc9262015-06-29 16:01:14 -07001369 TP_CONDITION(ei),
Chao Yu1ec46102015-02-05 17:59:59 +08001370
1371 TP_STRUCT__entry(
1372 __field(dev_t, dev)
1373 __field(ino_t, ino)
1374 __field(unsigned int, pgofs)
1375 __field(unsigned int, fofs)
1376 __field(u32, blk)
1377 __field(unsigned int, len)
1378 ),
1379
1380 TP_fast_assign(
1381 __entry->dev = inode->i_sb->s_dev;
1382 __entry->ino = inode->i_ino;
1383 __entry->pgofs = pgofs;
Jaegeuk Kim84bc9262015-06-29 16:01:14 -07001384 __entry->fofs = ei->fofs;
1385 __entry->blk = ei->blk;
1386 __entry->len = ei->len;
Chao Yu1ec46102015-02-05 17:59:59 +08001387 ),
1388
1389 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1390 "ext_info(fofs: %u, blk: %u, len: %u)",
1391 show_dev_ino(__entry),
1392 __entry->pgofs,
1393 __entry->fofs,
1394 __entry->blk,
1395 __entry->len)
1396);
1397
Chao Yu744288c2015-09-06 17:50:13 +08001398TRACE_EVENT(f2fs_update_extent_tree_range,
Chao Yu1ec46102015-02-05 17:59:59 +08001399
Chao Yu744288c2015-09-06 17:50:13 +08001400 TP_PROTO(struct inode *inode, unsigned int pgofs, block_t blkaddr,
1401 unsigned int len),
Chao Yu1ec46102015-02-05 17:59:59 +08001402
Chao Yu744288c2015-09-06 17:50:13 +08001403 TP_ARGS(inode, pgofs, blkaddr, len),
Chao Yu1ec46102015-02-05 17:59:59 +08001404
1405 TP_STRUCT__entry(
1406 __field(dev_t, dev)
1407 __field(ino_t, ino)
1408 __field(unsigned int, pgofs)
1409 __field(u32, blk)
Chao Yu744288c2015-09-06 17:50:13 +08001410 __field(unsigned int, len)
Chao Yu1ec46102015-02-05 17:59:59 +08001411 ),
1412
1413 TP_fast_assign(
1414 __entry->dev = inode->i_sb->s_dev;
1415 __entry->ino = inode->i_ino;
1416 __entry->pgofs = pgofs;
1417 __entry->blk = blkaddr;
Chao Yu744288c2015-09-06 17:50:13 +08001418 __entry->len = len;
Chao Yu1ec46102015-02-05 17:59:59 +08001419 ),
1420
Chao Yu744288c2015-09-06 17:50:13 +08001421 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1422 "blkaddr = %u, len = %u",
Chao Yu1ec46102015-02-05 17:59:59 +08001423 show_dev_ino(__entry),
1424 __entry->pgofs,
Chao Yu744288c2015-09-06 17:50:13 +08001425 __entry->blk,
1426 __entry->len)
Chao Yu1ec46102015-02-05 17:59:59 +08001427);
1428
1429TRACE_EVENT(f2fs_shrink_extent_tree,
1430
1431 TP_PROTO(struct f2fs_sb_info *sbi, unsigned int node_cnt,
1432 unsigned int tree_cnt),
1433
1434 TP_ARGS(sbi, node_cnt, tree_cnt),
1435
1436 TP_STRUCT__entry(
1437 __field(dev_t, dev)
1438 __field(unsigned int, node_cnt)
1439 __field(unsigned int, tree_cnt)
1440 ),
1441
1442 TP_fast_assign(
1443 __entry->dev = sbi->sb->s_dev;
1444 __entry->node_cnt = node_cnt;
1445 __entry->tree_cnt = tree_cnt;
1446 ),
1447
1448 TP_printk("dev = (%d,%d), shrunk: node_cnt = %u, tree_cnt = %u",
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001449 show_dev(__entry->dev),
Chao Yu1ec46102015-02-05 17:59:59 +08001450 __entry->node_cnt,
1451 __entry->tree_cnt)
1452);
1453
1454TRACE_EVENT(f2fs_destroy_extent_tree,
1455
1456 TP_PROTO(struct inode *inode, unsigned int node_cnt),
1457
1458 TP_ARGS(inode, node_cnt),
1459
1460 TP_STRUCT__entry(
1461 __field(dev_t, dev)
1462 __field(ino_t, ino)
1463 __field(unsigned int, node_cnt)
1464 ),
1465
1466 TP_fast_assign(
1467 __entry->dev = inode->i_sb->s_dev;
1468 __entry->ino = inode->i_ino;
1469 __entry->node_cnt = node_cnt;
1470 ),
1471
1472 TP_printk("dev = (%d,%d), ino = %lu, destroyed: node_cnt = %u",
1473 show_dev_ino(__entry),
1474 __entry->node_cnt)
1475);
1476
Chao Yu4cf18532015-12-17 17:17:16 +08001477DECLARE_EVENT_CLASS(f2fs_sync_dirty_inodes,
1478
Jaegeuk Kim523be8a2016-05-13 12:36:58 -07001479 TP_PROTO(struct super_block *sb, int type, s64 count),
Chao Yu4cf18532015-12-17 17:17:16 +08001480
1481 TP_ARGS(sb, type, count),
1482
1483 TP_STRUCT__entry(
1484 __field(dev_t, dev)
1485 __field(int, type)
Jaegeuk Kim523be8a2016-05-13 12:36:58 -07001486 __field(s64, count)
Chao Yu4cf18532015-12-17 17:17:16 +08001487 ),
1488
1489 TP_fast_assign(
1490 __entry->dev = sb->s_dev;
1491 __entry->type = type;
1492 __entry->count = count;
1493 ),
1494
Jaegeuk Kim523be8a2016-05-13 12:36:58 -07001495 TP_printk("dev = (%d,%d), %s, dirty count = %lld",
Jaegeuk Kimd50aaee2017-02-15 11:14:06 -08001496 show_dev(__entry->dev),
Chao Yu4cf18532015-12-17 17:17:16 +08001497 show_file_type(__entry->type),
1498 __entry->count)
1499);
1500
1501DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_enter,
1502
Jaegeuk Kim523be8a2016-05-13 12:36:58 -07001503 TP_PROTO(struct super_block *sb, int type, s64 count),
Chao Yu4cf18532015-12-17 17:17:16 +08001504
1505 TP_ARGS(sb, type, count)
1506);
1507
1508DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_exit,
1509
Jaegeuk Kim523be8a2016-05-13 12:36:58 -07001510 TP_PROTO(struct super_block *sb, int type, s64 count),
Chao Yu4cf18532015-12-17 17:17:16 +08001511
1512 TP_ARGS(sb, type, count)
1513);
1514
Namjae Jeona2a4a7e2013-04-20 01:28:40 +09001515#endif /* _TRACE_F2FS_H */
1516
1517 /* This part must be outside protection */
1518#include <trace/define_trace.h>