f2fs.h 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM f2fs
  3. #if !defined(_TRACE_F2FS_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_F2FS_H
  5. #include <linux/tracepoint.h>
  6. #define show_dev(dev) MAJOR(dev), MINOR(dev)
  7. #define show_dev_ino(entry) show_dev(entry->dev), (unsigned long)entry->ino
  8. TRACE_DEFINE_ENUM(NODE);
  9. TRACE_DEFINE_ENUM(DATA);
  10. TRACE_DEFINE_ENUM(META);
  11. TRACE_DEFINE_ENUM(META_FLUSH);
  12. TRACE_DEFINE_ENUM(INMEM);
  13. TRACE_DEFINE_ENUM(INMEM_DROP);
  14. TRACE_DEFINE_ENUM(INMEM_INVALIDATE);
  15. TRACE_DEFINE_ENUM(INMEM_REVOKE);
  16. TRACE_DEFINE_ENUM(IPU);
  17. TRACE_DEFINE_ENUM(OPU);
  18. TRACE_DEFINE_ENUM(CURSEG_HOT_DATA);
  19. TRACE_DEFINE_ENUM(CURSEG_WARM_DATA);
  20. TRACE_DEFINE_ENUM(CURSEG_COLD_DATA);
  21. TRACE_DEFINE_ENUM(CURSEG_HOT_NODE);
  22. TRACE_DEFINE_ENUM(CURSEG_WARM_NODE);
  23. TRACE_DEFINE_ENUM(CURSEG_COLD_NODE);
  24. TRACE_DEFINE_ENUM(NO_CHECK_TYPE);
  25. TRACE_DEFINE_ENUM(GC_GREEDY);
  26. TRACE_DEFINE_ENUM(GC_CB);
  27. TRACE_DEFINE_ENUM(FG_GC);
  28. TRACE_DEFINE_ENUM(BG_GC);
  29. TRACE_DEFINE_ENUM(LFS);
  30. TRACE_DEFINE_ENUM(SSR);
  31. TRACE_DEFINE_ENUM(__REQ_RAHEAD);
  32. TRACE_DEFINE_ENUM(__REQ_SYNC);
  33. TRACE_DEFINE_ENUM(__REQ_NOIDLE);
  34. TRACE_DEFINE_ENUM(__REQ_PREFLUSH);
  35. TRACE_DEFINE_ENUM(__REQ_FUA);
  36. TRACE_DEFINE_ENUM(__REQ_PRIO);
  37. TRACE_DEFINE_ENUM(__REQ_META);
  38. TRACE_DEFINE_ENUM(CP_UMOUNT);
  39. TRACE_DEFINE_ENUM(CP_FASTBOOT);
  40. TRACE_DEFINE_ENUM(CP_SYNC);
  41. TRACE_DEFINE_ENUM(CP_RECOVERY);
  42. TRACE_DEFINE_ENUM(CP_DISCARD);
  43. TRACE_DEFINE_ENUM(CP_TRIMMED);
  44. #define show_block_type(type) \
  45. __print_symbolic(type, \
  46. { NODE, "NODE" }, \
  47. { DATA, "DATA" }, \
  48. { META, "META" }, \
  49. { META_FLUSH, "META_FLUSH" }, \
  50. { INMEM, "INMEM" }, \
  51. { INMEM_DROP, "INMEM_DROP" }, \
  52. { INMEM_INVALIDATE, "INMEM_INVALIDATE" }, \
  53. { INMEM_REVOKE, "INMEM_REVOKE" }, \
  54. { IPU, "IN-PLACE" }, \
  55. { OPU, "OUT-OF-PLACE" })
  56. #define F2FS_OP_FLAGS (REQ_RAHEAD | REQ_SYNC | REQ_META | REQ_PRIO | \
  57. REQ_PREFLUSH | REQ_FUA)
  58. #define F2FS_BIO_FLAG_MASK(t) (t & F2FS_OP_FLAGS)
  59. #define show_bio_type(op,op_flags) show_bio_op(op), \
  60. show_bio_op_flags(op_flags)
  61. #define show_bio_op(op) \
  62. __print_symbolic(op, \
  63. { REQ_OP_READ, "READ" }, \
  64. { REQ_OP_WRITE, "WRITE" }, \
  65. { REQ_OP_DISCARD, "DISCARD" }, \
  66. { REQ_OP_SECURE_ERASE, "SECURE_ERASE" }, \
  67. { REQ_OP_WRITE_SAME, "WRITE_SAME" })
  68. #define show_bio_op_flags(flags) \
  69. __print_flags(F2FS_BIO_FLAG_MASK(flags), "|", \
  70. { REQ_RAHEAD, "R" }, \
  71. { REQ_SYNC, "S" }, \
  72. { REQ_META, "M" }, \
  73. { REQ_PRIO, "P" }, \
  74. { REQ_PREFLUSH, "PF" }, \
  75. { REQ_FUA, "FUA" })
  76. #define show_block_temp(temp) \
  77. __print_symbolic(temp, \
  78. { HOT, "HOT" }, \
  79. { WARM, "WARM" }, \
  80. { COLD, "COLD" })
  81. #define show_data_type(type) \
  82. __print_symbolic(type, \
  83. { CURSEG_HOT_DATA, "Hot DATA" }, \
  84. { CURSEG_WARM_DATA, "Warm DATA" }, \
  85. { CURSEG_COLD_DATA, "Cold DATA" }, \
  86. { CURSEG_HOT_NODE, "Hot NODE" }, \
  87. { CURSEG_WARM_NODE, "Warm NODE" }, \
  88. { CURSEG_COLD_NODE, "Cold NODE" }, \
  89. { NO_CHECK_TYPE, "No TYPE" })
  90. #define show_file_type(type) \
  91. __print_symbolic(type, \
  92. { 0, "FILE" }, \
  93. { 1, "DIR" })
  94. #define show_gc_type(type) \
  95. __print_symbolic(type, \
  96. { FG_GC, "Foreground GC" }, \
  97. { BG_GC, "Background GC" })
  98. #define show_alloc_mode(type) \
  99. __print_symbolic(type, \
  100. { LFS, "LFS-mode" }, \
  101. { SSR, "SSR-mode" })
  102. #define show_victim_policy(type) \
  103. __print_symbolic(type, \
  104. { GC_GREEDY, "Greedy" }, \
  105. { GC_CB, "Cost-Benefit" })
  106. #define show_cpreason(type) \
  107. __print_flags(type, "|", \
  108. { CP_UMOUNT, "Umount" }, \
  109. { CP_FASTBOOT, "Fastboot" }, \
  110. { CP_SYNC, "Sync" }, \
  111. { CP_RECOVERY, "Recovery" }, \
  112. { CP_DISCARD, "Discard" }, \
  113. { CP_UMOUNT, "Umount" }, \
  114. { CP_TRIMMED, "Trimmed" })
  115. #define show_fsync_cpreason(type) \
  116. __print_symbolic(type, \
  117. { CP_NO_NEEDED, "no needed" }, \
  118. { CP_NON_REGULAR, "non regular" }, \
  119. { CP_HARDLINK, "hardlink" }, \
  120. { CP_SB_NEED_CP, "sb needs cp" }, \
  121. { CP_WRONG_PINO, "wrong pino" }, \
  122. { CP_NO_SPC_ROLL, "no space roll forward" }, \
  123. { CP_NODE_NEED_CP, "node needs cp" }, \
  124. { CP_FASTBOOT_MODE, "fastboot mode" }, \
  125. { CP_SPEC_LOG_NUM, "log type is 2" }, \
  126. { CP_RECOVER_DIR, "dir needs recovery" })
  127. #define show_shutdown_mode(type) \
  128. __print_symbolic(type, \
  129. { F2FS_GOING_DOWN_FULLSYNC, "full sync" }, \
  130. { F2FS_GOING_DOWN_METASYNC, "meta sync" }, \
  131. { F2FS_GOING_DOWN_NOSYNC, "no sync" }, \
  132. { F2FS_GOING_DOWN_METAFLUSH, "meta flush" }, \
  133. { F2FS_GOING_DOWN_NEED_FSCK, "need fsck" })
  134. struct f2fs_sb_info;
  135. struct f2fs_io_info;
  136. struct extent_info;
  137. struct victim_sel_policy;
  138. struct f2fs_map_blocks;
  139. DECLARE_EVENT_CLASS(f2fs__inode,
  140. TP_PROTO(struct inode *inode),
  141. TP_ARGS(inode),
  142. TP_STRUCT__entry(
  143. __field(dev_t, dev)
  144. __field(ino_t, ino)
  145. __field(ino_t, pino)
  146. __field(umode_t, mode)
  147. __field(loff_t, size)
  148. __field(unsigned int, nlink)
  149. __field(blkcnt_t, blocks)
  150. __field(__u8, advise)
  151. ),
  152. TP_fast_assign(
  153. __entry->dev = inode->i_sb->s_dev;
  154. __entry->ino = inode->i_ino;
  155. __entry->pino = F2FS_I(inode)->i_pino;
  156. __entry->mode = inode->i_mode;
  157. __entry->nlink = inode->i_nlink;
  158. __entry->size = inode->i_size;
  159. __entry->blocks = inode->i_blocks;
  160. __entry->advise = F2FS_I(inode)->i_advise;
  161. ),
  162. TP_printk("dev = (%d,%d), ino = %lu, pino = %lu, i_mode = 0x%hx, "
  163. "i_size = %lld, i_nlink = %u, i_blocks = %llu, i_advise = 0x%x",
  164. show_dev_ino(__entry),
  165. (unsigned long)__entry->pino,
  166. __entry->mode,
  167. __entry->size,
  168. (unsigned int)__entry->nlink,
  169. (unsigned long long)__entry->blocks,
  170. (unsigned char)__entry->advise)
  171. );
  172. DECLARE_EVENT_CLASS(f2fs__inode_exit,
  173. TP_PROTO(struct inode *inode, int ret),
  174. TP_ARGS(inode, ret),
  175. TP_STRUCT__entry(
  176. __field(dev_t, dev)
  177. __field(ino_t, ino)
  178. __field(int, ret)
  179. ),
  180. TP_fast_assign(
  181. __entry->dev = inode->i_sb->s_dev;
  182. __entry->ino = inode->i_ino;
  183. __entry->ret = ret;
  184. ),
  185. TP_printk("dev = (%d,%d), ino = %lu, ret = %d",
  186. show_dev_ino(__entry),
  187. __entry->ret)
  188. );
  189. DEFINE_EVENT(f2fs__inode, f2fs_sync_file_enter,
  190. TP_PROTO(struct inode *inode),
  191. TP_ARGS(inode)
  192. );
  193. TRACE_EVENT(f2fs_sync_file_exit,
  194. TP_PROTO(struct inode *inode, int cp_reason, int datasync, int ret),
  195. TP_ARGS(inode, cp_reason, datasync, ret),
  196. TP_STRUCT__entry(
  197. __field(dev_t, dev)
  198. __field(ino_t, ino)
  199. __field(int, cp_reason)
  200. __field(int, datasync)
  201. __field(int, ret)
  202. ),
  203. TP_fast_assign(
  204. __entry->dev = inode->i_sb->s_dev;
  205. __entry->ino = inode->i_ino;
  206. __entry->cp_reason = cp_reason;
  207. __entry->datasync = datasync;
  208. __entry->ret = ret;
  209. ),
  210. TP_printk("dev = (%d,%d), ino = %lu, cp_reason: %s, "
  211. "datasync = %d, ret = %d",
  212. show_dev_ino(__entry),
  213. show_fsync_cpreason(__entry->cp_reason),
  214. __entry->datasync,
  215. __entry->ret)
  216. );
  217. TRACE_EVENT(f2fs_sync_fs,
  218. TP_PROTO(struct super_block *sb, int wait),
  219. TP_ARGS(sb, wait),
  220. TP_STRUCT__entry(
  221. __field(dev_t, dev)
  222. __field(int, dirty)
  223. __field(int, wait)
  224. ),
  225. TP_fast_assign(
  226. __entry->dev = sb->s_dev;
  227. __entry->dirty = is_sbi_flag_set(F2FS_SB(sb), SBI_IS_DIRTY);
  228. __entry->wait = wait;
  229. ),
  230. TP_printk("dev = (%d,%d), superblock is %s, wait = %d",
  231. show_dev(__entry->dev),
  232. __entry->dirty ? "dirty" : "not dirty",
  233. __entry->wait)
  234. );
  235. DEFINE_EVENT(f2fs__inode, f2fs_iget,
  236. TP_PROTO(struct inode *inode),
  237. TP_ARGS(inode)
  238. );
  239. DEFINE_EVENT(f2fs__inode_exit, f2fs_iget_exit,
  240. TP_PROTO(struct inode *inode, int ret),
  241. TP_ARGS(inode, ret)
  242. );
  243. DEFINE_EVENT(f2fs__inode, f2fs_evict_inode,
  244. TP_PROTO(struct inode *inode),
  245. TP_ARGS(inode)
  246. );
  247. DEFINE_EVENT(f2fs__inode_exit, f2fs_new_inode,
  248. TP_PROTO(struct inode *inode, int ret),
  249. TP_ARGS(inode, ret)
  250. );
  251. TRACE_EVENT(f2fs_unlink_enter,
  252. TP_PROTO(struct inode *dir, struct dentry *dentry),
  253. TP_ARGS(dir, dentry),
  254. TP_STRUCT__entry(
  255. __field(dev_t, dev)
  256. __field(ino_t, ino)
  257. __field(loff_t, size)
  258. __field(blkcnt_t, blocks)
  259. __field(const char *, name)
  260. ),
  261. TP_fast_assign(
  262. __entry->dev = dir->i_sb->s_dev;
  263. __entry->ino = dir->i_ino;
  264. __entry->size = dir->i_size;
  265. __entry->blocks = dir->i_blocks;
  266. __entry->name = dentry->d_name.name;
  267. ),
  268. TP_printk("dev = (%d,%d), dir ino = %lu, i_size = %lld, "
  269. "i_blocks = %llu, name = %s",
  270. show_dev_ino(__entry),
  271. __entry->size,
  272. (unsigned long long)__entry->blocks,
  273. __entry->name)
  274. );
  275. DEFINE_EVENT(f2fs__inode_exit, f2fs_unlink_exit,
  276. TP_PROTO(struct inode *inode, int ret),
  277. TP_ARGS(inode, ret)
  278. );
  279. DEFINE_EVENT(f2fs__inode_exit, f2fs_drop_inode,
  280. TP_PROTO(struct inode *inode, int ret),
  281. TP_ARGS(inode, ret)
  282. );
  283. DEFINE_EVENT(f2fs__inode, f2fs_truncate,
  284. TP_PROTO(struct inode *inode),
  285. TP_ARGS(inode)
  286. );
  287. TRACE_EVENT(f2fs_truncate_data_blocks_range,
  288. TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs, int free),
  289. TP_ARGS(inode, nid, ofs, free),
  290. TP_STRUCT__entry(
  291. __field(dev_t, dev)
  292. __field(ino_t, ino)
  293. __field(nid_t, nid)
  294. __field(unsigned int, ofs)
  295. __field(int, free)
  296. ),
  297. TP_fast_assign(
  298. __entry->dev = inode->i_sb->s_dev;
  299. __entry->ino = inode->i_ino;
  300. __entry->nid = nid;
  301. __entry->ofs = ofs;
  302. __entry->free = free;
  303. ),
  304. TP_printk("dev = (%d,%d), ino = %lu, nid = %u, offset = %u, freed = %d",
  305. show_dev_ino(__entry),
  306. (unsigned int)__entry->nid,
  307. __entry->ofs,
  308. __entry->free)
  309. );
  310. DECLARE_EVENT_CLASS(f2fs__truncate_op,
  311. TP_PROTO(struct inode *inode, u64 from),
  312. TP_ARGS(inode, from),
  313. TP_STRUCT__entry(
  314. __field(dev_t, dev)
  315. __field(ino_t, ino)
  316. __field(loff_t, size)
  317. __field(blkcnt_t, blocks)
  318. __field(u64, from)
  319. ),
  320. TP_fast_assign(
  321. __entry->dev = inode->i_sb->s_dev;
  322. __entry->ino = inode->i_ino;
  323. __entry->size = inode->i_size;
  324. __entry->blocks = inode->i_blocks;
  325. __entry->from = from;
  326. ),
  327. TP_printk("dev = (%d,%d), ino = %lu, i_size = %lld, i_blocks = %llu, "
  328. "start file offset = %llu",
  329. show_dev_ino(__entry),
  330. __entry->size,
  331. (unsigned long long)__entry->blocks,
  332. (unsigned long long)__entry->from)
  333. );
  334. DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_blocks_enter,
  335. TP_PROTO(struct inode *inode, u64 from),
  336. TP_ARGS(inode, from)
  337. );
  338. DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_blocks_exit,
  339. TP_PROTO(struct inode *inode, int ret),
  340. TP_ARGS(inode, ret)
  341. );
  342. DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_inode_blocks_enter,
  343. TP_PROTO(struct inode *inode, u64 from),
  344. TP_ARGS(inode, from)
  345. );
  346. DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_inode_blocks_exit,
  347. TP_PROTO(struct inode *inode, int ret),
  348. TP_ARGS(inode, ret)
  349. );
  350. DECLARE_EVENT_CLASS(f2fs__truncate_node,
  351. TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
  352. TP_ARGS(inode, nid, blk_addr),
  353. TP_STRUCT__entry(
  354. __field(dev_t, dev)
  355. __field(ino_t, ino)
  356. __field(nid_t, nid)
  357. __field(block_t, blk_addr)
  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->blk_addr = blk_addr;
  364. ),
  365. TP_printk("dev = (%d,%d), ino = %lu, nid = %u, block_address = 0x%llx",
  366. show_dev_ino(__entry),
  367. (unsigned int)__entry->nid,
  368. (unsigned long long)__entry->blk_addr)
  369. );
  370. DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_nodes_enter,
  371. TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
  372. TP_ARGS(inode, nid, blk_addr)
  373. );
  374. DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_nodes_exit,
  375. TP_PROTO(struct inode *inode, int ret),
  376. TP_ARGS(inode, ret)
  377. );
  378. DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_node,
  379. TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
  380. TP_ARGS(inode, nid, blk_addr)
  381. );
  382. TRACE_EVENT(f2fs_truncate_partial_nodes,
  383. TP_PROTO(struct inode *inode, nid_t nid[], int depth, int err),
  384. TP_ARGS(inode, nid, depth, err),
  385. TP_STRUCT__entry(
  386. __field(dev_t, dev)
  387. __field(ino_t, ino)
  388. __field(nid_t, nid[3])
  389. __field(int, depth)
  390. __field(int, err)
  391. ),
  392. TP_fast_assign(
  393. __entry->dev = inode->i_sb->s_dev;
  394. __entry->ino = inode->i_ino;
  395. __entry->nid[0] = nid[0];
  396. __entry->nid[1] = nid[1];
  397. __entry->nid[2] = nid[2];
  398. __entry->depth = depth;
  399. __entry->err = err;
  400. ),
  401. TP_printk("dev = (%d,%d), ino = %lu, "
  402. "nid[0] = %u, nid[1] = %u, nid[2] = %u, depth = %d, err = %d",
  403. show_dev_ino(__entry),
  404. (unsigned int)__entry->nid[0],
  405. (unsigned int)__entry->nid[1],
  406. (unsigned int)__entry->nid[2],
  407. __entry->depth,
  408. __entry->err)
  409. );
  410. TRACE_EVENT(f2fs_map_blocks,
  411. TP_PROTO(struct inode *inode, struct f2fs_map_blocks *map, int ret),
  412. TP_ARGS(inode, map, ret),
  413. TP_STRUCT__entry(
  414. __field(dev_t, dev)
  415. __field(ino_t, ino)
  416. __field(block_t, m_lblk)
  417. __field(block_t, m_pblk)
  418. __field(unsigned int, m_len)
  419. __field(unsigned int, m_flags)
  420. __field(int, m_seg_type)
  421. __field(bool, m_may_create)
  422. __field(int, ret)
  423. ),
  424. TP_fast_assign(
  425. __entry->dev = inode->i_sb->s_dev;
  426. __entry->ino = inode->i_ino;
  427. __entry->m_lblk = map->m_lblk;
  428. __entry->m_pblk = map->m_pblk;
  429. __entry->m_len = map->m_len;
  430. __entry->m_flags = map->m_flags;
  431. __entry->m_seg_type = map->m_seg_type;
  432. __entry->m_may_create = map->m_may_create;
  433. __entry->ret = ret;
  434. ),
  435. TP_printk("dev = (%d,%d), ino = %lu, file offset = %llu, "
  436. "start blkaddr = 0x%llx, len = 0x%llx, flags = %u,"
  437. "seg_type = %d, may_create = %d, err = %d",
  438. show_dev_ino(__entry),
  439. (unsigned long long)__entry->m_lblk,
  440. (unsigned long long)__entry->m_pblk,
  441. (unsigned long long)__entry->m_len,
  442. __entry->m_flags,
  443. __entry->m_seg_type,
  444. __entry->m_may_create,
  445. __entry->ret)
  446. );
  447. TRACE_EVENT(f2fs_background_gc,
  448. TP_PROTO(struct super_block *sb, unsigned int wait_ms,
  449. unsigned int prefree, unsigned int free),
  450. TP_ARGS(sb, wait_ms, prefree, free),
  451. TP_STRUCT__entry(
  452. __field(dev_t, dev)
  453. __field(unsigned int, wait_ms)
  454. __field(unsigned int, prefree)
  455. __field(unsigned int, free)
  456. ),
  457. TP_fast_assign(
  458. __entry->dev = sb->s_dev;
  459. __entry->wait_ms = wait_ms;
  460. __entry->prefree = prefree;
  461. __entry->free = free;
  462. ),
  463. TP_printk("dev = (%d,%d), wait_ms = %u, prefree = %u, free = %u",
  464. show_dev(__entry->dev),
  465. __entry->wait_ms,
  466. __entry->prefree,
  467. __entry->free)
  468. );
  469. TRACE_EVENT(f2fs_gc_begin,
  470. TP_PROTO(struct super_block *sb, bool sync, bool background,
  471. long long dirty_nodes, long long dirty_dents,
  472. long long dirty_imeta, unsigned int free_sec,
  473. unsigned int free_seg, int reserved_seg,
  474. unsigned int prefree_seg),
  475. TP_ARGS(sb, sync, background, dirty_nodes, dirty_dents, dirty_imeta,
  476. free_sec, free_seg, reserved_seg, prefree_seg),
  477. TP_STRUCT__entry(
  478. __field(dev_t, dev)
  479. __field(bool, sync)
  480. __field(bool, background)
  481. __field(long long, dirty_nodes)
  482. __field(long long, dirty_dents)
  483. __field(long long, dirty_imeta)
  484. __field(unsigned int, free_sec)
  485. __field(unsigned int, free_seg)
  486. __field(int, reserved_seg)
  487. __field(unsigned int, prefree_seg)
  488. ),
  489. TP_fast_assign(
  490. __entry->dev = sb->s_dev;
  491. __entry->sync = sync;
  492. __entry->background = background;
  493. __entry->dirty_nodes = dirty_nodes;
  494. __entry->dirty_dents = dirty_dents;
  495. __entry->dirty_imeta = dirty_imeta;
  496. __entry->free_sec = free_sec;
  497. __entry->free_seg = free_seg;
  498. __entry->reserved_seg = reserved_seg;
  499. __entry->prefree_seg = prefree_seg;
  500. ),
  501. TP_printk("dev = (%d,%d), sync = %d, background = %d, nodes = %lld, "
  502. "dents = %lld, imeta = %lld, free_sec:%u, free_seg:%u, "
  503. "rsv_seg:%d, prefree_seg:%u",
  504. show_dev(__entry->dev),
  505. __entry->sync,
  506. __entry->background,
  507. __entry->dirty_nodes,
  508. __entry->dirty_dents,
  509. __entry->dirty_imeta,
  510. __entry->free_sec,
  511. __entry->free_seg,
  512. __entry->reserved_seg,
  513. __entry->prefree_seg)
  514. );
  515. TRACE_EVENT(f2fs_gc_end,
  516. TP_PROTO(struct super_block *sb, int ret, int seg_freed,
  517. int sec_freed, long long dirty_nodes,
  518. long long dirty_dents, long long dirty_imeta,
  519. unsigned int free_sec, unsigned int free_seg,
  520. int reserved_seg, unsigned int prefree_seg),
  521. TP_ARGS(sb, ret, seg_freed, sec_freed, dirty_nodes, dirty_dents,
  522. dirty_imeta, free_sec, free_seg, reserved_seg, prefree_seg),
  523. TP_STRUCT__entry(
  524. __field(dev_t, dev)
  525. __field(int, ret)
  526. __field(int, seg_freed)
  527. __field(int, sec_freed)
  528. __field(long long, dirty_nodes)
  529. __field(long long, dirty_dents)
  530. __field(long long, dirty_imeta)
  531. __field(unsigned int, free_sec)
  532. __field(unsigned int, free_seg)
  533. __field(int, reserved_seg)
  534. __field(unsigned int, prefree_seg)
  535. ),
  536. TP_fast_assign(
  537. __entry->dev = sb->s_dev;
  538. __entry->ret = ret;
  539. __entry->seg_freed = seg_freed;
  540. __entry->sec_freed = sec_freed;
  541. __entry->dirty_nodes = dirty_nodes;
  542. __entry->dirty_dents = dirty_dents;
  543. __entry->dirty_imeta = dirty_imeta;
  544. __entry->free_sec = free_sec;
  545. __entry->free_seg = free_seg;
  546. __entry->reserved_seg = reserved_seg;
  547. __entry->prefree_seg = prefree_seg;
  548. ),
  549. TP_printk("dev = (%d,%d), ret = %d, seg_freed = %d, sec_freed = %d, "
  550. "nodes = %lld, dents = %lld, imeta = %lld, free_sec:%u, "
  551. "free_seg:%u, rsv_seg:%d, prefree_seg:%u",
  552. show_dev(__entry->dev),
  553. __entry->ret,
  554. __entry->seg_freed,
  555. __entry->sec_freed,
  556. __entry->dirty_nodes,
  557. __entry->dirty_dents,
  558. __entry->dirty_imeta,
  559. __entry->free_sec,
  560. __entry->free_seg,
  561. __entry->reserved_seg,
  562. __entry->prefree_seg)
  563. );
  564. TRACE_EVENT(f2fs_get_victim,
  565. TP_PROTO(struct super_block *sb, int type, int gc_type,
  566. struct victim_sel_policy *p, unsigned int pre_victim,
  567. unsigned int prefree, unsigned int free),
  568. TP_ARGS(sb, type, gc_type, p, pre_victim, prefree, free),
  569. TP_STRUCT__entry(
  570. __field(dev_t, dev)
  571. __field(int, type)
  572. __field(int, gc_type)
  573. __field(int, alloc_mode)
  574. __field(int, gc_mode)
  575. __field(unsigned int, victim)
  576. __field(unsigned int, cost)
  577. __field(unsigned int, ofs_unit)
  578. __field(unsigned int, pre_victim)
  579. __field(unsigned int, prefree)
  580. __field(unsigned int, free)
  581. ),
  582. TP_fast_assign(
  583. __entry->dev = sb->s_dev;
  584. __entry->type = type;
  585. __entry->gc_type = gc_type;
  586. __entry->alloc_mode = p->alloc_mode;
  587. __entry->gc_mode = p->gc_mode;
  588. __entry->victim = p->min_segno;
  589. __entry->cost = p->min_cost;
  590. __entry->ofs_unit = p->ofs_unit;
  591. __entry->pre_victim = pre_victim;
  592. __entry->prefree = prefree;
  593. __entry->free = free;
  594. ),
  595. TP_printk("dev = (%d,%d), type = %s, policy = (%s, %s, %s), "
  596. "victim = %u, cost = %u, ofs_unit = %u, "
  597. "pre_victim_secno = %d, prefree = %u, free = %u",
  598. show_dev(__entry->dev),
  599. show_data_type(__entry->type),
  600. show_gc_type(__entry->gc_type),
  601. show_alloc_mode(__entry->alloc_mode),
  602. show_victim_policy(__entry->gc_mode),
  603. __entry->victim,
  604. __entry->cost,
  605. __entry->ofs_unit,
  606. (int)__entry->pre_victim,
  607. __entry->prefree,
  608. __entry->free)
  609. );
  610. TRACE_EVENT(f2fs_lookup_start,
  611. TP_PROTO(struct inode *dir, struct dentry *dentry, unsigned int flags),
  612. TP_ARGS(dir, dentry, flags),
  613. TP_STRUCT__entry(
  614. __field(dev_t, dev)
  615. __field(ino_t, ino)
  616. __field(const char *, name)
  617. __field(unsigned int, flags)
  618. ),
  619. TP_fast_assign(
  620. __entry->dev = dir->i_sb->s_dev;
  621. __entry->ino = dir->i_ino;
  622. __entry->name = dentry->d_name.name;
  623. __entry->flags = flags;
  624. ),
  625. TP_printk("dev = (%d,%d), pino = %lu, name:%s, flags:%u",
  626. show_dev_ino(__entry),
  627. __entry->name,
  628. __entry->flags)
  629. );
  630. TRACE_EVENT(f2fs_lookup_end,
  631. TP_PROTO(struct inode *dir, struct dentry *dentry, nid_t ino,
  632. int err),
  633. TP_ARGS(dir, dentry, ino, err),
  634. TP_STRUCT__entry(
  635. __field(dev_t, dev)
  636. __field(ino_t, ino)
  637. __field(const char *, name)
  638. __field(nid_t, cino)
  639. __field(int, err)
  640. ),
  641. TP_fast_assign(
  642. __entry->dev = dir->i_sb->s_dev;
  643. __entry->ino = dir->i_ino;
  644. __entry->name = dentry->d_name.name;
  645. __entry->cino = ino;
  646. __entry->err = err;
  647. ),
  648. TP_printk("dev = (%d,%d), pino = %lu, name:%s, ino:%u, err:%d",
  649. show_dev_ino(__entry),
  650. __entry->name,
  651. __entry->cino,
  652. __entry->err)
  653. );
  654. TRACE_EVENT(f2fs_readdir,
  655. TP_PROTO(struct inode *dir, loff_t start_pos, loff_t end_pos, int err),
  656. TP_ARGS(dir, start_pos, end_pos, err),
  657. TP_STRUCT__entry(
  658. __field(dev_t, dev)
  659. __field(ino_t, ino)
  660. __field(loff_t, start)
  661. __field(loff_t, end)
  662. __field(int, err)
  663. ),
  664. TP_fast_assign(
  665. __entry->dev = dir->i_sb->s_dev;
  666. __entry->ino = dir->i_ino;
  667. __entry->start = start_pos;
  668. __entry->end = end_pos;
  669. __entry->err = err;
  670. ),
  671. TP_printk("dev = (%d,%d), ino = %lu, start_pos:%llu, end_pos:%llu, err:%d",
  672. show_dev_ino(__entry),
  673. __entry->start,
  674. __entry->end,
  675. __entry->err)
  676. );
  677. TRACE_EVENT(f2fs_fallocate,
  678. TP_PROTO(struct inode *inode, int mode,
  679. loff_t offset, loff_t len, int ret),
  680. TP_ARGS(inode, mode, offset, len, ret),
  681. TP_STRUCT__entry(
  682. __field(dev_t, dev)
  683. __field(ino_t, ino)
  684. __field(int, mode)
  685. __field(loff_t, offset)
  686. __field(loff_t, len)
  687. __field(loff_t, size)
  688. __field(blkcnt_t, blocks)
  689. __field(int, ret)
  690. ),
  691. TP_fast_assign(
  692. __entry->dev = inode->i_sb->s_dev;
  693. __entry->ino = inode->i_ino;
  694. __entry->mode = mode;
  695. __entry->offset = offset;
  696. __entry->len = len;
  697. __entry->size = inode->i_size;
  698. __entry->blocks = inode->i_blocks;
  699. __entry->ret = ret;
  700. ),
  701. TP_printk("dev = (%d,%d), ino = %lu, mode = %x, offset = %lld, "
  702. "len = %lld, i_size = %lld, i_blocks = %llu, ret = %d",
  703. show_dev_ino(__entry),
  704. __entry->mode,
  705. (unsigned long long)__entry->offset,
  706. (unsigned long long)__entry->len,
  707. (unsigned long long)__entry->size,
  708. (unsigned long long)__entry->blocks,
  709. __entry->ret)
  710. );
  711. TRACE_EVENT(f2fs_direct_IO_enter,
  712. TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw),
  713. TP_ARGS(inode, offset, len, rw),
  714. TP_STRUCT__entry(
  715. __field(dev_t, dev)
  716. __field(ino_t, ino)
  717. __field(loff_t, pos)
  718. __field(unsigned long, len)
  719. __field(int, rw)
  720. ),
  721. TP_fast_assign(
  722. __entry->dev = inode->i_sb->s_dev;
  723. __entry->ino = inode->i_ino;
  724. __entry->pos = offset;
  725. __entry->len = len;
  726. __entry->rw = rw;
  727. ),
  728. TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu rw = %d",
  729. show_dev_ino(__entry),
  730. __entry->pos,
  731. __entry->len,
  732. __entry->rw)
  733. );
  734. TRACE_EVENT(f2fs_direct_IO_exit,
  735. TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
  736. int rw, int ret),
  737. TP_ARGS(inode, offset, len, rw, ret),
  738. TP_STRUCT__entry(
  739. __field(dev_t, dev)
  740. __field(ino_t, ino)
  741. __field(loff_t, pos)
  742. __field(unsigned long, len)
  743. __field(int, rw)
  744. __field(int, ret)
  745. ),
  746. TP_fast_assign(
  747. __entry->dev = inode->i_sb->s_dev;
  748. __entry->ino = inode->i_ino;
  749. __entry->pos = offset;
  750. __entry->len = len;
  751. __entry->rw = rw;
  752. __entry->ret = ret;
  753. ),
  754. TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu "
  755. "rw = %d ret = %d",
  756. show_dev_ino(__entry),
  757. __entry->pos,
  758. __entry->len,
  759. __entry->rw,
  760. __entry->ret)
  761. );
  762. TRACE_EVENT(f2fs_reserve_new_blocks,
  763. TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs_in_node,
  764. blkcnt_t count),
  765. TP_ARGS(inode, nid, ofs_in_node, count),
  766. TP_STRUCT__entry(
  767. __field(dev_t, dev)
  768. __field(nid_t, nid)
  769. __field(unsigned int, ofs_in_node)
  770. __field(blkcnt_t, count)
  771. ),
  772. TP_fast_assign(
  773. __entry->dev = inode->i_sb->s_dev;
  774. __entry->nid = nid;
  775. __entry->ofs_in_node = ofs_in_node;
  776. __entry->count = count;
  777. ),
  778. TP_printk("dev = (%d,%d), nid = %u, ofs_in_node = %u, count = %llu",
  779. show_dev(__entry->dev),
  780. (unsigned int)__entry->nid,
  781. __entry->ofs_in_node,
  782. (unsigned long long)__entry->count)
  783. );
  784. DECLARE_EVENT_CLASS(f2fs__submit_page_bio,
  785. TP_PROTO(struct page *page, struct f2fs_io_info *fio),
  786. TP_ARGS(page, fio),
  787. TP_STRUCT__entry(
  788. __field(dev_t, dev)
  789. __field(ino_t, ino)
  790. __field(pgoff_t, index)
  791. __field(block_t, old_blkaddr)
  792. __field(block_t, new_blkaddr)
  793. __field(int, op)
  794. __field(int, op_flags)
  795. __field(int, temp)
  796. __field(int, type)
  797. ),
  798. TP_fast_assign(
  799. __entry->dev = page->mapping->host->i_sb->s_dev;
  800. __entry->ino = page->mapping->host->i_ino;
  801. __entry->index = page->index;
  802. __entry->old_blkaddr = fio->old_blkaddr;
  803. __entry->new_blkaddr = fio->new_blkaddr;
  804. __entry->op = fio->op;
  805. __entry->op_flags = fio->op_flags;
  806. __entry->temp = fio->temp;
  807. __entry->type = fio->type;
  808. ),
  809. TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, "
  810. "oldaddr = 0x%llx, newaddr = 0x%llx, rw = %s(%s), type = %s_%s",
  811. show_dev_ino(__entry),
  812. (unsigned long)__entry->index,
  813. (unsigned long long)__entry->old_blkaddr,
  814. (unsigned long long)__entry->new_blkaddr,
  815. show_bio_type(__entry->op, __entry->op_flags),
  816. show_block_temp(__entry->temp),
  817. show_block_type(__entry->type))
  818. );
  819. DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_bio,
  820. TP_PROTO(struct page *page, struct f2fs_io_info *fio),
  821. TP_ARGS(page, fio),
  822. TP_CONDITION(page->mapping)
  823. );
  824. DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_write,
  825. TP_PROTO(struct page *page, struct f2fs_io_info *fio),
  826. TP_ARGS(page, fio),
  827. TP_CONDITION(page->mapping)
  828. );
  829. DECLARE_EVENT_CLASS(f2fs__bio,
  830. TP_PROTO(struct super_block *sb, int type, struct bio *bio),
  831. TP_ARGS(sb, type, bio),
  832. TP_STRUCT__entry(
  833. __field(dev_t, dev)
  834. __field(dev_t, target)
  835. __field(int, op)
  836. __field(int, op_flags)
  837. __field(int, type)
  838. __field(sector_t, sector)
  839. __field(unsigned int, size)
  840. ),
  841. TP_fast_assign(
  842. __entry->dev = sb->s_dev;
  843. __entry->target = bio->bi_bdev->bd_dev;
  844. __entry->op = bio_op(bio);
  845. __entry->op_flags = bio->bi_opf;
  846. __entry->type = type;
  847. __entry->sector = bio->bi_iter.bi_sector;
  848. __entry->size = bio->bi_iter.bi_size;
  849. ),
  850. TP_printk("dev = (%d,%d)/(%d,%d), rw = %s(%s), %s, sector = %lld, size = %u",
  851. show_dev(__entry->target),
  852. show_dev(__entry->dev),
  853. show_bio_type(__entry->op, __entry->op_flags),
  854. show_block_type(__entry->type),
  855. (unsigned long long)__entry->sector,
  856. __entry->size)
  857. );
  858. DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_prepare_write_bio,
  859. TP_PROTO(struct super_block *sb, int type, struct bio *bio),
  860. TP_ARGS(sb, type, bio),
  861. TP_CONDITION(bio)
  862. );
  863. DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_prepare_read_bio,
  864. TP_PROTO(struct super_block *sb, int type, struct bio *bio),
  865. TP_ARGS(sb, type, bio),
  866. TP_CONDITION(bio)
  867. );
  868. DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_read_bio,
  869. TP_PROTO(struct super_block *sb, int type, struct bio *bio),
  870. TP_ARGS(sb, type, bio),
  871. TP_CONDITION(bio)
  872. );
  873. DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_write_bio,
  874. TP_PROTO(struct super_block *sb, int type, struct bio *bio),
  875. TP_ARGS(sb, type, bio),
  876. TP_CONDITION(bio)
  877. );
  878. TRACE_EVENT(f2fs_write_begin,
  879. TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
  880. unsigned int flags),
  881. TP_ARGS(inode, pos, len, flags),
  882. TP_STRUCT__entry(
  883. __field(dev_t, dev)
  884. __field(ino_t, ino)
  885. __field(loff_t, pos)
  886. __field(unsigned int, len)
  887. __field(unsigned int, flags)
  888. ),
  889. TP_fast_assign(
  890. __entry->dev = inode->i_sb->s_dev;
  891. __entry->ino = inode->i_ino;
  892. __entry->pos = pos;
  893. __entry->len = len;
  894. __entry->flags = flags;
  895. ),
  896. TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, flags = %u",
  897. show_dev_ino(__entry),
  898. (unsigned long long)__entry->pos,
  899. __entry->len,
  900. __entry->flags)
  901. );
  902. TRACE_EVENT(f2fs_write_end,
  903. TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
  904. unsigned int copied),
  905. TP_ARGS(inode, pos, len, copied),
  906. TP_STRUCT__entry(
  907. __field(dev_t, dev)
  908. __field(ino_t, ino)
  909. __field(loff_t, pos)
  910. __field(unsigned int, len)
  911. __field(unsigned int, copied)
  912. ),
  913. TP_fast_assign(
  914. __entry->dev = inode->i_sb->s_dev;
  915. __entry->ino = inode->i_ino;
  916. __entry->pos = pos;
  917. __entry->len = len;
  918. __entry->copied = copied;
  919. ),
  920. TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, copied = %u",
  921. show_dev_ino(__entry),
  922. (unsigned long long)__entry->pos,
  923. __entry->len,
  924. __entry->copied)
  925. );
  926. DECLARE_EVENT_CLASS(f2fs__page,
  927. TP_PROTO(struct page *page, int type),
  928. TP_ARGS(page, type),
  929. TP_STRUCT__entry(
  930. __field(dev_t, dev)
  931. __field(ino_t, ino)
  932. __field(int, type)
  933. __field(int, dir)
  934. __field(pgoff_t, index)
  935. __field(int, dirty)
  936. __field(int, uptodate)
  937. ),
  938. TP_fast_assign(
  939. __entry->dev = page->mapping->host->i_sb->s_dev;
  940. __entry->ino = page->mapping->host->i_ino;
  941. __entry->type = type;
  942. __entry->dir = S_ISDIR(page->mapping->host->i_mode);
  943. __entry->index = page->index;
  944. __entry->dirty = PageDirty(page);
  945. __entry->uptodate = PageUptodate(page);
  946. ),
  947. TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, "
  948. "dirty = %d, uptodate = %d",
  949. show_dev_ino(__entry),
  950. show_block_type(__entry->type),
  951. show_file_type(__entry->dir),
  952. (unsigned long)__entry->index,
  953. __entry->dirty,
  954. __entry->uptodate)
  955. );
  956. DEFINE_EVENT(f2fs__page, f2fs_writepage,
  957. TP_PROTO(struct page *page, int type),
  958. TP_ARGS(page, type)
  959. );
  960. DEFINE_EVENT(f2fs__page, f2fs_do_write_data_page,
  961. TP_PROTO(struct page *page, int type),
  962. TP_ARGS(page, type)
  963. );
  964. DEFINE_EVENT(f2fs__page, f2fs_readpage,
  965. TP_PROTO(struct page *page, int type),
  966. TP_ARGS(page, type)
  967. );
  968. DEFINE_EVENT(f2fs__page, f2fs_set_page_dirty,
  969. TP_PROTO(struct page *page, int type),
  970. TP_ARGS(page, type)
  971. );
  972. DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite,
  973. TP_PROTO(struct page *page, int type),
  974. TP_ARGS(page, type)
  975. );
  976. DEFINE_EVENT(f2fs__page, f2fs_register_inmem_page,
  977. TP_PROTO(struct page *page, int type),
  978. TP_ARGS(page, type)
  979. );
  980. DEFINE_EVENT(f2fs__page, f2fs_commit_inmem_page,
  981. TP_PROTO(struct page *page, int type),
  982. TP_ARGS(page, type)
  983. );
  984. TRACE_EVENT(f2fs_writepages,
  985. TP_PROTO(struct inode *inode, struct writeback_control *wbc, int type),
  986. TP_ARGS(inode, wbc, type),
  987. TP_STRUCT__entry(
  988. __field(dev_t, dev)
  989. __field(ino_t, ino)
  990. __field(int, type)
  991. __field(int, dir)
  992. __field(long, nr_to_write)
  993. __field(long, pages_skipped)
  994. __field(loff_t, range_start)
  995. __field(loff_t, range_end)
  996. __field(pgoff_t, writeback_index)
  997. __field(int, sync_mode)
  998. __field(char, for_kupdate)
  999. __field(char, for_background)
  1000. __field(char, tagged_writepages)
  1001. __field(char, for_reclaim)
  1002. __field(char, range_cyclic)
  1003. __field(char, for_sync)
  1004. ),
  1005. TP_fast_assign(
  1006. __entry->dev = inode->i_sb->s_dev;
  1007. __entry->ino = inode->i_ino;
  1008. __entry->type = type;
  1009. __entry->dir = S_ISDIR(inode->i_mode);
  1010. __entry->nr_to_write = wbc->nr_to_write;
  1011. __entry->pages_skipped = wbc->pages_skipped;
  1012. __entry->range_start = wbc->range_start;
  1013. __entry->range_end = wbc->range_end;
  1014. __entry->writeback_index = inode->i_mapping->writeback_index;
  1015. __entry->sync_mode = wbc->sync_mode;
  1016. __entry->for_kupdate = wbc->for_kupdate;
  1017. __entry->for_background = wbc->for_background;
  1018. __entry->tagged_writepages = wbc->tagged_writepages;
  1019. __entry->for_reclaim = wbc->for_reclaim;
  1020. __entry->range_cyclic = wbc->range_cyclic;
  1021. __entry->for_sync = wbc->for_sync;
  1022. ),
  1023. TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, "
  1024. "skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, "
  1025. "kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u",
  1026. show_dev_ino(__entry),
  1027. show_block_type(__entry->type),
  1028. show_file_type(__entry->dir),
  1029. __entry->nr_to_write,
  1030. __entry->pages_skipped,
  1031. __entry->range_start,
  1032. __entry->range_end,
  1033. (unsigned long)__entry->writeback_index,
  1034. __entry->sync_mode,
  1035. __entry->for_kupdate,
  1036. __entry->for_background,
  1037. __entry->tagged_writepages,
  1038. __entry->for_reclaim,
  1039. __entry->range_cyclic,
  1040. __entry->for_sync)
  1041. );
  1042. TRACE_EVENT(f2fs_readpages,
  1043. TP_PROTO(struct inode *inode, struct page *page, unsigned int nrpage),
  1044. TP_ARGS(inode, page, nrpage),
  1045. TP_STRUCT__entry(
  1046. __field(dev_t, dev)
  1047. __field(ino_t, ino)
  1048. __field(pgoff_t, start)
  1049. __field(unsigned int, nrpage)
  1050. ),
  1051. TP_fast_assign(
  1052. __entry->dev = inode->i_sb->s_dev;
  1053. __entry->ino = inode->i_ino;
  1054. __entry->start = page->index;
  1055. __entry->nrpage = nrpage;
  1056. ),
  1057. TP_printk("dev = (%d,%d), ino = %lu, start = %lu nrpage = %u",
  1058. show_dev_ino(__entry),
  1059. (unsigned long)__entry->start,
  1060. __entry->nrpage)
  1061. );
  1062. TRACE_EVENT(f2fs_write_checkpoint,
  1063. TP_PROTO(struct super_block *sb, int reason, char *msg),
  1064. TP_ARGS(sb, reason, msg),
  1065. TP_STRUCT__entry(
  1066. __field(dev_t, dev)
  1067. __field(int, reason)
  1068. __field(char *, msg)
  1069. ),
  1070. TP_fast_assign(
  1071. __entry->dev = sb->s_dev;
  1072. __entry->reason = reason;
  1073. __entry->msg = msg;
  1074. ),
  1075. TP_printk("dev = (%d,%d), checkpoint for %s, state = %s",
  1076. show_dev(__entry->dev),
  1077. show_cpreason(__entry->reason),
  1078. __entry->msg)
  1079. );
  1080. DECLARE_EVENT_CLASS(f2fs_discard,
  1081. TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
  1082. TP_ARGS(dev, blkstart, blklen),
  1083. TP_STRUCT__entry(
  1084. __field(dev_t, dev)
  1085. __field(block_t, blkstart)
  1086. __field(block_t, blklen)
  1087. ),
  1088. TP_fast_assign(
  1089. __entry->dev = dev->bd_dev;
  1090. __entry->blkstart = blkstart;
  1091. __entry->blklen = blklen;
  1092. ),
  1093. TP_printk("dev = (%d,%d), blkstart = 0x%llx, blklen = 0x%llx",
  1094. show_dev(__entry->dev),
  1095. (unsigned long long)__entry->blkstart,
  1096. (unsigned long long)__entry->blklen)
  1097. );
  1098. DEFINE_EVENT(f2fs_discard, f2fs_queue_discard,
  1099. TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
  1100. TP_ARGS(dev, blkstart, blklen)
  1101. );
  1102. DEFINE_EVENT(f2fs_discard, f2fs_issue_discard,
  1103. TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
  1104. TP_ARGS(dev, blkstart, blklen)
  1105. );
  1106. DEFINE_EVENT(f2fs_discard, f2fs_remove_discard,
  1107. TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen),
  1108. TP_ARGS(dev, blkstart, blklen)
  1109. );
  1110. TRACE_EVENT(f2fs_issue_reset_zone,
  1111. TP_PROTO(struct block_device *dev, block_t blkstart),
  1112. TP_ARGS(dev, blkstart),
  1113. TP_STRUCT__entry(
  1114. __field(dev_t, dev)
  1115. __field(block_t, blkstart)
  1116. ),
  1117. TP_fast_assign(
  1118. __entry->dev = dev->bd_dev;
  1119. __entry->blkstart = blkstart;
  1120. ),
  1121. TP_printk("dev = (%d,%d), reset zone at block = 0x%llx",
  1122. show_dev(__entry->dev),
  1123. (unsigned long long)__entry->blkstart)
  1124. );
  1125. TRACE_EVENT(f2fs_issue_flush,
  1126. TP_PROTO(struct block_device *dev, unsigned int nobarrier,
  1127. unsigned int flush_merge, int ret),
  1128. TP_ARGS(dev, nobarrier, flush_merge, ret),
  1129. TP_STRUCT__entry(
  1130. __field(dev_t, dev)
  1131. __field(unsigned int, nobarrier)
  1132. __field(unsigned int, flush_merge)
  1133. __field(int, ret)
  1134. ),
  1135. TP_fast_assign(
  1136. __entry->dev = dev->bd_dev;
  1137. __entry->nobarrier = nobarrier;
  1138. __entry->flush_merge = flush_merge;
  1139. __entry->ret = ret;
  1140. ),
  1141. TP_printk("dev = (%d,%d), %s %s, ret = %d",
  1142. show_dev(__entry->dev),
  1143. __entry->nobarrier ? "skip (nobarrier)" : "issue",
  1144. __entry->flush_merge ? " with flush_merge" : "",
  1145. __entry->ret)
  1146. );
  1147. TRACE_EVENT(f2fs_lookup_extent_tree_start,
  1148. TP_PROTO(struct inode *inode, unsigned int pgofs),
  1149. TP_ARGS(inode, pgofs),
  1150. TP_STRUCT__entry(
  1151. __field(dev_t, dev)
  1152. __field(ino_t, ino)
  1153. __field(unsigned int, pgofs)
  1154. ),
  1155. TP_fast_assign(
  1156. __entry->dev = inode->i_sb->s_dev;
  1157. __entry->ino = inode->i_ino;
  1158. __entry->pgofs = pgofs;
  1159. ),
  1160. TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u",
  1161. show_dev_ino(__entry),
  1162. __entry->pgofs)
  1163. );
  1164. TRACE_EVENT_CONDITION(f2fs_lookup_extent_tree_end,
  1165. TP_PROTO(struct inode *inode, unsigned int pgofs,
  1166. struct extent_info *ei),
  1167. TP_ARGS(inode, pgofs, ei),
  1168. TP_CONDITION(ei),
  1169. TP_STRUCT__entry(
  1170. __field(dev_t, dev)
  1171. __field(ino_t, ino)
  1172. __field(unsigned int, pgofs)
  1173. __field(unsigned int, fofs)
  1174. __field(u32, blk)
  1175. __field(unsigned int, len)
  1176. ),
  1177. TP_fast_assign(
  1178. __entry->dev = inode->i_sb->s_dev;
  1179. __entry->ino = inode->i_ino;
  1180. __entry->pgofs = pgofs;
  1181. __entry->fofs = ei->fofs;
  1182. __entry->blk = ei->blk;
  1183. __entry->len = ei->len;
  1184. ),
  1185. TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
  1186. "ext_info(fofs: %u, blk: %u, len: %u)",
  1187. show_dev_ino(__entry),
  1188. __entry->pgofs,
  1189. __entry->fofs,
  1190. __entry->blk,
  1191. __entry->len)
  1192. );
  1193. TRACE_EVENT(f2fs_update_extent_tree_range,
  1194. TP_PROTO(struct inode *inode, unsigned int pgofs, block_t blkaddr,
  1195. unsigned int len),
  1196. TP_ARGS(inode, pgofs, blkaddr, len),
  1197. TP_STRUCT__entry(
  1198. __field(dev_t, dev)
  1199. __field(ino_t, ino)
  1200. __field(unsigned int, pgofs)
  1201. __field(u32, blk)
  1202. __field(unsigned int, len)
  1203. ),
  1204. TP_fast_assign(
  1205. __entry->dev = inode->i_sb->s_dev;
  1206. __entry->ino = inode->i_ino;
  1207. __entry->pgofs = pgofs;
  1208. __entry->blk = blkaddr;
  1209. __entry->len = len;
  1210. ),
  1211. TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
  1212. "blkaddr = %u, len = %u",
  1213. show_dev_ino(__entry),
  1214. __entry->pgofs,
  1215. __entry->blk,
  1216. __entry->len)
  1217. );
  1218. TRACE_EVENT(f2fs_shrink_extent_tree,
  1219. TP_PROTO(struct f2fs_sb_info *sbi, unsigned int node_cnt,
  1220. unsigned int tree_cnt),
  1221. TP_ARGS(sbi, node_cnt, tree_cnt),
  1222. TP_STRUCT__entry(
  1223. __field(dev_t, dev)
  1224. __field(unsigned int, node_cnt)
  1225. __field(unsigned int, tree_cnt)
  1226. ),
  1227. TP_fast_assign(
  1228. __entry->dev = sbi->sb->s_dev;
  1229. __entry->node_cnt = node_cnt;
  1230. __entry->tree_cnt = tree_cnt;
  1231. ),
  1232. TP_printk("dev = (%d,%d), shrunk: node_cnt = %u, tree_cnt = %u",
  1233. show_dev(__entry->dev),
  1234. __entry->node_cnt,
  1235. __entry->tree_cnt)
  1236. );
  1237. TRACE_EVENT(f2fs_destroy_extent_tree,
  1238. TP_PROTO(struct inode *inode, unsigned int node_cnt),
  1239. TP_ARGS(inode, node_cnt),
  1240. TP_STRUCT__entry(
  1241. __field(dev_t, dev)
  1242. __field(ino_t, ino)
  1243. __field(unsigned int, node_cnt)
  1244. ),
  1245. TP_fast_assign(
  1246. __entry->dev = inode->i_sb->s_dev;
  1247. __entry->ino = inode->i_ino;
  1248. __entry->node_cnt = node_cnt;
  1249. ),
  1250. TP_printk("dev = (%d,%d), ino = %lu, destroyed: node_cnt = %u",
  1251. show_dev_ino(__entry),
  1252. __entry->node_cnt)
  1253. );
  1254. DECLARE_EVENT_CLASS(f2fs_sync_dirty_inodes,
  1255. TP_PROTO(struct super_block *sb, int type, s64 count),
  1256. TP_ARGS(sb, type, count),
  1257. TP_STRUCT__entry(
  1258. __field(dev_t, dev)
  1259. __field(int, type)
  1260. __field(s64, count)
  1261. ),
  1262. TP_fast_assign(
  1263. __entry->dev = sb->s_dev;
  1264. __entry->type = type;
  1265. __entry->count = count;
  1266. ),
  1267. TP_printk("dev = (%d,%d), %s, dirty count = %lld",
  1268. show_dev(__entry->dev),
  1269. show_file_type(__entry->type),
  1270. __entry->count)
  1271. );
  1272. DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_enter,
  1273. TP_PROTO(struct super_block *sb, int type, s64 count),
  1274. TP_ARGS(sb, type, count)
  1275. );
  1276. DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_exit,
  1277. TP_PROTO(struct super_block *sb, int type, s64 count),
  1278. TP_ARGS(sb, type, count)
  1279. );
  1280. TRACE_EVENT(f2fs_shutdown,
  1281. TP_PROTO(struct f2fs_sb_info *sbi, unsigned int mode, int ret),
  1282. TP_ARGS(sbi, mode, ret),
  1283. TP_STRUCT__entry(
  1284. __field(dev_t, dev)
  1285. __field(unsigned int, mode)
  1286. __field(int, ret)
  1287. ),
  1288. TP_fast_assign(
  1289. __entry->dev = sbi->sb->s_dev;
  1290. __entry->mode = mode;
  1291. __entry->ret = ret;
  1292. ),
  1293. TP_printk("dev = (%d,%d), mode: %s, ret:%d",
  1294. show_dev(__entry->dev),
  1295. show_shutdown_mode(__entry->mode),
  1296. __entry->ret)
  1297. );
  1298. #endif /* _TRACE_F2FS_H */
  1299. /* This part must be outside protection */
  1300. #include <trace/define_trace.h>