f2fs.h 36 KB

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