f2fs.h 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271
  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(entry) MAJOR(entry->dev), MINOR(entry->dev)
  7. #define show_dev_ino(entry) show_dev(entry), (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(IPU);
  15. TRACE_DEFINE_ENUM(OPU);
  16. TRACE_DEFINE_ENUM(CURSEG_HOT_DATA);
  17. TRACE_DEFINE_ENUM(CURSEG_WARM_DATA);
  18. TRACE_DEFINE_ENUM(CURSEG_COLD_DATA);
  19. TRACE_DEFINE_ENUM(CURSEG_HOT_NODE);
  20. TRACE_DEFINE_ENUM(CURSEG_WARM_NODE);
  21. TRACE_DEFINE_ENUM(CURSEG_COLD_NODE);
  22. TRACE_DEFINE_ENUM(NO_CHECK_TYPE);
  23. TRACE_DEFINE_ENUM(GC_GREEDY);
  24. TRACE_DEFINE_ENUM(GC_CB);
  25. TRACE_DEFINE_ENUM(FG_GC);
  26. TRACE_DEFINE_ENUM(BG_GC);
  27. TRACE_DEFINE_ENUM(LFS);
  28. TRACE_DEFINE_ENUM(SSR);
  29. TRACE_DEFINE_ENUM(__REQ_RAHEAD);
  30. TRACE_DEFINE_ENUM(__REQ_WRITE);
  31. TRACE_DEFINE_ENUM(__REQ_SYNC);
  32. TRACE_DEFINE_ENUM(__REQ_NOIDLE);
  33. TRACE_DEFINE_ENUM(__REQ_FLUSH);
  34. TRACE_DEFINE_ENUM(__REQ_FUA);
  35. TRACE_DEFINE_ENUM(__REQ_PRIO);
  36. TRACE_DEFINE_ENUM(__REQ_META);
  37. TRACE_DEFINE_ENUM(CP_UMOUNT);
  38. TRACE_DEFINE_ENUM(CP_FASTBOOT);
  39. TRACE_DEFINE_ENUM(CP_SYNC);
  40. TRACE_DEFINE_ENUM(CP_RECOVERY);
  41. TRACE_DEFINE_ENUM(CP_DISCARD);
  42. #define show_block_type(type) \
  43. __print_symbolic(type, \
  44. { NODE, "NODE" }, \
  45. { DATA, "DATA" }, \
  46. { META, "META" }, \
  47. { META_FLUSH, "META_FLUSH" }, \
  48. { INMEM, "INMEM" }, \
  49. { INMEM_DROP, "INMEM_DROP" }, \
  50. { IPU, "IN-PLACE" }, \
  51. { OPU, "OUT-OF-PLACE" })
  52. #define F2FS_BIO_MASK(t) (t & (READA | WRITE_FLUSH_FUA))
  53. #define F2FS_BIO_EXTRA_MASK(t) (t & (REQ_META | REQ_PRIO))
  54. #define show_bio_type(type) show_bio_base(type), show_bio_extra(type)
  55. #define show_bio_base(type) \
  56. __print_symbolic(F2FS_BIO_MASK(type), \
  57. { READ, "READ" }, \
  58. { READA, "READAHEAD" }, \
  59. { READ_SYNC, "READ_SYNC" }, \
  60. { WRITE, "WRITE" }, \
  61. { WRITE_SYNC, "WRITE_SYNC" }, \
  62. { WRITE_FLUSH, "WRITE_FLUSH" }, \
  63. { WRITE_FUA, "WRITE_FUA" }, \
  64. { WRITE_FLUSH_FUA, "WRITE_FLUSH_FUA" })
  65. #define show_bio_extra(type) \
  66. __print_symbolic(F2FS_BIO_EXTRA_MASK(type), \
  67. { REQ_META, "(M)" }, \
  68. { REQ_PRIO, "(P)" }, \
  69. { REQ_META | REQ_PRIO, "(MP)" }, \
  70. { 0, " \b" })
  71. #define show_data_type(type) \
  72. __print_symbolic(type, \
  73. { CURSEG_HOT_DATA, "Hot DATA" }, \
  74. { CURSEG_WARM_DATA, "Warm DATA" }, \
  75. { CURSEG_COLD_DATA, "Cold DATA" }, \
  76. { CURSEG_HOT_NODE, "Hot NODE" }, \
  77. { CURSEG_WARM_NODE, "Warm NODE" }, \
  78. { CURSEG_COLD_NODE, "Cold NODE" }, \
  79. { NO_CHECK_TYPE, "No TYPE" })
  80. #define show_file_type(type) \
  81. __print_symbolic(type, \
  82. { 0, "FILE" }, \
  83. { 1, "DIR" })
  84. #define show_gc_type(type) \
  85. __print_symbolic(type, \
  86. { FG_GC, "Foreground GC" }, \
  87. { BG_GC, "Background GC" })
  88. #define show_alloc_mode(type) \
  89. __print_symbolic(type, \
  90. { LFS, "LFS-mode" }, \
  91. { SSR, "SSR-mode" })
  92. #define show_victim_policy(type) \
  93. __print_symbolic(type, \
  94. { GC_GREEDY, "Greedy" }, \
  95. { GC_CB, "Cost-Benefit" })
  96. #define show_cpreason(type) \
  97. __print_symbolic(type, \
  98. { CP_UMOUNT, "Umount" }, \
  99. { CP_FASTBOOT, "Fastboot" }, \
  100. { CP_SYNC, "Sync" }, \
  101. { CP_RECOVERY, "Recovery" }, \
  102. { CP_DISCARD, "Discard" })
  103. struct victim_sel_policy;
  104. struct f2fs_map_blocks;
  105. DECLARE_EVENT_CLASS(f2fs__inode,
  106. TP_PROTO(struct inode *inode),
  107. TP_ARGS(inode),
  108. TP_STRUCT__entry(
  109. __field(dev_t, dev)
  110. __field(ino_t, ino)
  111. __field(ino_t, pino)
  112. __field(umode_t, mode)
  113. __field(loff_t, size)
  114. __field(unsigned int, nlink)
  115. __field(blkcnt_t, blocks)
  116. __field(__u8, advise)
  117. ),
  118. TP_fast_assign(
  119. __entry->dev = inode->i_sb->s_dev;
  120. __entry->ino = inode->i_ino;
  121. __entry->pino = F2FS_I(inode)->i_pino;
  122. __entry->mode = inode->i_mode;
  123. __entry->nlink = inode->i_nlink;
  124. __entry->size = inode->i_size;
  125. __entry->blocks = inode->i_blocks;
  126. __entry->advise = F2FS_I(inode)->i_advise;
  127. ),
  128. TP_printk("dev = (%d,%d), ino = %lu, pino = %lu, i_mode = 0x%hx, "
  129. "i_size = %lld, i_nlink = %u, i_blocks = %llu, i_advise = 0x%x",
  130. show_dev_ino(__entry),
  131. (unsigned long)__entry->pino,
  132. __entry->mode,
  133. __entry->size,
  134. (unsigned int)__entry->nlink,
  135. (unsigned long long)__entry->blocks,
  136. (unsigned char)__entry->advise)
  137. );
  138. DECLARE_EVENT_CLASS(f2fs__inode_exit,
  139. TP_PROTO(struct inode *inode, int ret),
  140. TP_ARGS(inode, ret),
  141. TP_STRUCT__entry(
  142. __field(dev_t, dev)
  143. __field(ino_t, ino)
  144. __field(int, ret)
  145. ),
  146. TP_fast_assign(
  147. __entry->dev = inode->i_sb->s_dev;
  148. __entry->ino = inode->i_ino;
  149. __entry->ret = ret;
  150. ),
  151. TP_printk("dev = (%d,%d), ino = %lu, ret = %d",
  152. show_dev_ino(__entry),
  153. __entry->ret)
  154. );
  155. DEFINE_EVENT(f2fs__inode, f2fs_sync_file_enter,
  156. TP_PROTO(struct inode *inode),
  157. TP_ARGS(inode)
  158. );
  159. TRACE_EVENT(f2fs_sync_file_exit,
  160. TP_PROTO(struct inode *inode, int need_cp, int datasync, int ret),
  161. TP_ARGS(inode, need_cp, datasync, ret),
  162. TP_STRUCT__entry(
  163. __field(dev_t, dev)
  164. __field(ino_t, ino)
  165. __field(int, need_cp)
  166. __field(int, datasync)
  167. __field(int, ret)
  168. ),
  169. TP_fast_assign(
  170. __entry->dev = inode->i_sb->s_dev;
  171. __entry->ino = inode->i_ino;
  172. __entry->need_cp = need_cp;
  173. __entry->datasync = datasync;
  174. __entry->ret = ret;
  175. ),
  176. TP_printk("dev = (%d,%d), ino = %lu, checkpoint is %s, "
  177. "datasync = %d, ret = %d",
  178. show_dev_ino(__entry),
  179. __entry->need_cp ? "needed" : "not needed",
  180. __entry->datasync,
  181. __entry->ret)
  182. );
  183. TRACE_EVENT(f2fs_sync_fs,
  184. TP_PROTO(struct super_block *sb, int wait),
  185. TP_ARGS(sb, wait),
  186. TP_STRUCT__entry(
  187. __field(dev_t, dev)
  188. __field(int, dirty)
  189. __field(int, wait)
  190. ),
  191. TP_fast_assign(
  192. __entry->dev = sb->s_dev;
  193. __entry->dirty = is_sbi_flag_set(F2FS_SB(sb), SBI_IS_DIRTY);
  194. __entry->wait = wait;
  195. ),
  196. TP_printk("dev = (%d,%d), superblock is %s, wait = %d",
  197. show_dev(__entry),
  198. __entry->dirty ? "dirty" : "not dirty",
  199. __entry->wait)
  200. );
  201. DEFINE_EVENT(f2fs__inode, f2fs_iget,
  202. TP_PROTO(struct inode *inode),
  203. TP_ARGS(inode)
  204. );
  205. DEFINE_EVENT(f2fs__inode_exit, f2fs_iget_exit,
  206. TP_PROTO(struct inode *inode, int ret),
  207. TP_ARGS(inode, ret)
  208. );
  209. DEFINE_EVENT(f2fs__inode, f2fs_evict_inode,
  210. TP_PROTO(struct inode *inode),
  211. TP_ARGS(inode)
  212. );
  213. DEFINE_EVENT(f2fs__inode_exit, f2fs_new_inode,
  214. TP_PROTO(struct inode *inode, int ret),
  215. TP_ARGS(inode, ret)
  216. );
  217. TRACE_EVENT(f2fs_unlink_enter,
  218. TP_PROTO(struct inode *dir, struct dentry *dentry),
  219. TP_ARGS(dir, dentry),
  220. TP_STRUCT__entry(
  221. __field(dev_t, dev)
  222. __field(ino_t, ino)
  223. __field(loff_t, size)
  224. __field(blkcnt_t, blocks)
  225. __field(const char *, name)
  226. ),
  227. TP_fast_assign(
  228. __entry->dev = dir->i_sb->s_dev;
  229. __entry->ino = dir->i_ino;
  230. __entry->size = dir->i_size;
  231. __entry->blocks = dir->i_blocks;
  232. __entry->name = dentry->d_name.name;
  233. ),
  234. TP_printk("dev = (%d,%d), dir ino = %lu, i_size = %lld, "
  235. "i_blocks = %llu, name = %s",
  236. show_dev_ino(__entry),
  237. __entry->size,
  238. (unsigned long long)__entry->blocks,
  239. __entry->name)
  240. );
  241. DEFINE_EVENT(f2fs__inode_exit, f2fs_unlink_exit,
  242. TP_PROTO(struct inode *inode, int ret),
  243. TP_ARGS(inode, ret)
  244. );
  245. DEFINE_EVENT(f2fs__inode, f2fs_truncate,
  246. TP_PROTO(struct inode *inode),
  247. TP_ARGS(inode)
  248. );
  249. TRACE_EVENT(f2fs_truncate_data_blocks_range,
  250. TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs, int free),
  251. TP_ARGS(inode, nid, ofs, free),
  252. TP_STRUCT__entry(
  253. __field(dev_t, dev)
  254. __field(ino_t, ino)
  255. __field(nid_t, nid)
  256. __field(unsigned int, ofs)
  257. __field(int, free)
  258. ),
  259. TP_fast_assign(
  260. __entry->dev = inode->i_sb->s_dev;
  261. __entry->ino = inode->i_ino;
  262. __entry->nid = nid;
  263. __entry->ofs = ofs;
  264. __entry->free = free;
  265. ),
  266. TP_printk("dev = (%d,%d), ino = %lu, nid = %u, offset = %u, freed = %d",
  267. show_dev_ino(__entry),
  268. (unsigned int)__entry->nid,
  269. __entry->ofs,
  270. __entry->free)
  271. );
  272. DECLARE_EVENT_CLASS(f2fs__truncate_op,
  273. TP_PROTO(struct inode *inode, u64 from),
  274. TP_ARGS(inode, from),
  275. TP_STRUCT__entry(
  276. __field(dev_t, dev)
  277. __field(ino_t, ino)
  278. __field(loff_t, size)
  279. __field(blkcnt_t, blocks)
  280. __field(u64, from)
  281. ),
  282. TP_fast_assign(
  283. __entry->dev = inode->i_sb->s_dev;
  284. __entry->ino = inode->i_ino;
  285. __entry->size = inode->i_size;
  286. __entry->blocks = inode->i_blocks;
  287. __entry->from = from;
  288. ),
  289. TP_printk("dev = (%d,%d), ino = %lu, i_size = %lld, i_blocks = %llu, "
  290. "start file offset = %llu",
  291. show_dev_ino(__entry),
  292. __entry->size,
  293. (unsigned long long)__entry->blocks,
  294. (unsigned long long)__entry->from)
  295. );
  296. DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_blocks_enter,
  297. TP_PROTO(struct inode *inode, u64 from),
  298. TP_ARGS(inode, from)
  299. );
  300. DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_blocks_exit,
  301. TP_PROTO(struct inode *inode, int ret),
  302. TP_ARGS(inode, ret)
  303. );
  304. DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_inode_blocks_enter,
  305. TP_PROTO(struct inode *inode, u64 from),
  306. TP_ARGS(inode, from)
  307. );
  308. DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_inode_blocks_exit,
  309. TP_PROTO(struct inode *inode, int ret),
  310. TP_ARGS(inode, ret)
  311. );
  312. DECLARE_EVENT_CLASS(f2fs__truncate_node,
  313. TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
  314. TP_ARGS(inode, nid, blk_addr),
  315. TP_STRUCT__entry(
  316. __field(dev_t, dev)
  317. __field(ino_t, ino)
  318. __field(nid_t, nid)
  319. __field(block_t, blk_addr)
  320. ),
  321. TP_fast_assign(
  322. __entry->dev = inode->i_sb->s_dev;
  323. __entry->ino = inode->i_ino;
  324. __entry->nid = nid;
  325. __entry->blk_addr = blk_addr;
  326. ),
  327. TP_printk("dev = (%d,%d), ino = %lu, nid = %u, block_address = 0x%llx",
  328. show_dev_ino(__entry),
  329. (unsigned int)__entry->nid,
  330. (unsigned long long)__entry->blk_addr)
  331. );
  332. DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_nodes_enter,
  333. TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
  334. TP_ARGS(inode, nid, blk_addr)
  335. );
  336. DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_nodes_exit,
  337. TP_PROTO(struct inode *inode, int ret),
  338. TP_ARGS(inode, ret)
  339. );
  340. DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_node,
  341. TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr),
  342. TP_ARGS(inode, nid, blk_addr)
  343. );
  344. TRACE_EVENT(f2fs_truncate_partial_nodes,
  345. TP_PROTO(struct inode *inode, nid_t nid[], int depth, int err),
  346. TP_ARGS(inode, nid, depth, err),
  347. TP_STRUCT__entry(
  348. __field(dev_t, dev)
  349. __field(ino_t, ino)
  350. __field(nid_t, nid[3])
  351. __field(int, depth)
  352. __field(int, err)
  353. ),
  354. TP_fast_assign(
  355. __entry->dev = inode->i_sb->s_dev;
  356. __entry->ino = inode->i_ino;
  357. __entry->nid[0] = nid[0];
  358. __entry->nid[1] = nid[1];
  359. __entry->nid[2] = nid[2];
  360. __entry->depth = depth;
  361. __entry->err = err;
  362. ),
  363. TP_printk("dev = (%d,%d), ino = %lu, "
  364. "nid[0] = %u, nid[1] = %u, nid[2] = %u, depth = %d, err = %d",
  365. show_dev_ino(__entry),
  366. (unsigned int)__entry->nid[0],
  367. (unsigned int)__entry->nid[1],
  368. (unsigned int)__entry->nid[2],
  369. __entry->depth,
  370. __entry->err)
  371. );
  372. TRACE_EVENT(f2fs_map_blocks,
  373. TP_PROTO(struct inode *inode, struct f2fs_map_blocks *map, int ret),
  374. TP_ARGS(inode, map, ret),
  375. TP_STRUCT__entry(
  376. __field(dev_t, dev)
  377. __field(ino_t, ino)
  378. __field(block_t, m_lblk)
  379. __field(block_t, m_pblk)
  380. __field(unsigned int, m_len)
  381. __field(int, ret)
  382. ),
  383. TP_fast_assign(
  384. __entry->dev = inode->i_sb->s_dev;
  385. __entry->ino = inode->i_ino;
  386. __entry->m_lblk = map->m_lblk;
  387. __entry->m_pblk = map->m_pblk;
  388. __entry->m_len = map->m_len;
  389. __entry->ret = ret;
  390. ),
  391. TP_printk("dev = (%d,%d), ino = %lu, file offset = %llu, "
  392. "start blkaddr = 0x%llx, len = 0x%llx, err = %d",
  393. show_dev_ino(__entry),
  394. (unsigned long long)__entry->m_lblk,
  395. (unsigned long long)__entry->m_pblk,
  396. (unsigned long long)__entry->m_len,
  397. __entry->ret)
  398. );
  399. TRACE_EVENT(f2fs_background_gc,
  400. TP_PROTO(struct super_block *sb, long wait_ms,
  401. unsigned int prefree, unsigned int free),
  402. TP_ARGS(sb, wait_ms, prefree, free),
  403. TP_STRUCT__entry(
  404. __field(dev_t, dev)
  405. __field(long, wait_ms)
  406. __field(unsigned int, prefree)
  407. __field(unsigned int, free)
  408. ),
  409. TP_fast_assign(
  410. __entry->dev = sb->s_dev;
  411. __entry->wait_ms = wait_ms;
  412. __entry->prefree = prefree;
  413. __entry->free = free;
  414. ),
  415. TP_printk("dev = (%d,%d), wait_ms = %ld, prefree = %u, free = %u",
  416. show_dev(__entry),
  417. __entry->wait_ms,
  418. __entry->prefree,
  419. __entry->free)
  420. );
  421. TRACE_EVENT(f2fs_get_victim,
  422. TP_PROTO(struct super_block *sb, int type, int gc_type,
  423. struct victim_sel_policy *p, unsigned int pre_victim,
  424. unsigned int prefree, unsigned int free),
  425. TP_ARGS(sb, type, gc_type, p, pre_victim, prefree, free),
  426. TP_STRUCT__entry(
  427. __field(dev_t, dev)
  428. __field(int, type)
  429. __field(int, gc_type)
  430. __field(int, alloc_mode)
  431. __field(int, gc_mode)
  432. __field(unsigned int, victim)
  433. __field(unsigned int, ofs_unit)
  434. __field(unsigned int, pre_victim)
  435. __field(unsigned int, prefree)
  436. __field(unsigned int, free)
  437. ),
  438. TP_fast_assign(
  439. __entry->dev = sb->s_dev;
  440. __entry->type = type;
  441. __entry->gc_type = gc_type;
  442. __entry->alloc_mode = p->alloc_mode;
  443. __entry->gc_mode = p->gc_mode;
  444. __entry->victim = p->min_segno;
  445. __entry->ofs_unit = p->ofs_unit;
  446. __entry->pre_victim = pre_victim;
  447. __entry->prefree = prefree;
  448. __entry->free = free;
  449. ),
  450. TP_printk("dev = (%d,%d), type = %s, policy = (%s, %s, %s), victim = %u "
  451. "ofs_unit = %u, pre_victim_secno = %d, prefree = %u, free = %u",
  452. show_dev(__entry),
  453. show_data_type(__entry->type),
  454. show_gc_type(__entry->gc_type),
  455. show_alloc_mode(__entry->alloc_mode),
  456. show_victim_policy(__entry->gc_mode),
  457. __entry->victim,
  458. __entry->ofs_unit,
  459. (int)__entry->pre_victim,
  460. __entry->prefree,
  461. __entry->free)
  462. );
  463. TRACE_EVENT(f2fs_fallocate,
  464. TP_PROTO(struct inode *inode, int mode,
  465. loff_t offset, loff_t len, int ret),
  466. TP_ARGS(inode, mode, offset, len, ret),
  467. TP_STRUCT__entry(
  468. __field(dev_t, dev)
  469. __field(ino_t, ino)
  470. __field(int, mode)
  471. __field(loff_t, offset)
  472. __field(loff_t, len)
  473. __field(loff_t, size)
  474. __field(blkcnt_t, blocks)
  475. __field(int, ret)
  476. ),
  477. TP_fast_assign(
  478. __entry->dev = inode->i_sb->s_dev;
  479. __entry->ino = inode->i_ino;
  480. __entry->mode = mode;
  481. __entry->offset = offset;
  482. __entry->len = len;
  483. __entry->size = inode->i_size;
  484. __entry->blocks = inode->i_blocks;
  485. __entry->ret = ret;
  486. ),
  487. TP_printk("dev = (%d,%d), ino = %lu, mode = %x, offset = %lld, "
  488. "len = %lld, i_size = %lld, i_blocks = %llu, ret = %d",
  489. show_dev_ino(__entry),
  490. __entry->mode,
  491. (unsigned long long)__entry->offset,
  492. (unsigned long long)__entry->len,
  493. (unsigned long long)__entry->size,
  494. (unsigned long long)__entry->blocks,
  495. __entry->ret)
  496. );
  497. TRACE_EVENT(f2fs_direct_IO_enter,
  498. TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw),
  499. TP_ARGS(inode, offset, len, rw),
  500. TP_STRUCT__entry(
  501. __field(dev_t, dev)
  502. __field(ino_t, ino)
  503. __field(loff_t, pos)
  504. __field(unsigned long, len)
  505. __field(int, rw)
  506. ),
  507. TP_fast_assign(
  508. __entry->dev = inode->i_sb->s_dev;
  509. __entry->ino = inode->i_ino;
  510. __entry->pos = offset;
  511. __entry->len = len;
  512. __entry->rw = rw;
  513. ),
  514. TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu rw = %d",
  515. show_dev_ino(__entry),
  516. __entry->pos,
  517. __entry->len,
  518. __entry->rw)
  519. );
  520. TRACE_EVENT(f2fs_direct_IO_exit,
  521. TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
  522. int rw, int ret),
  523. TP_ARGS(inode, offset, len, rw, ret),
  524. TP_STRUCT__entry(
  525. __field(dev_t, dev)
  526. __field(ino_t, ino)
  527. __field(loff_t, pos)
  528. __field(unsigned long, len)
  529. __field(int, rw)
  530. __field(int, ret)
  531. ),
  532. TP_fast_assign(
  533. __entry->dev = inode->i_sb->s_dev;
  534. __entry->ino = inode->i_ino;
  535. __entry->pos = offset;
  536. __entry->len = len;
  537. __entry->rw = rw;
  538. __entry->ret = ret;
  539. ),
  540. TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu "
  541. "rw = %d ret = %d",
  542. show_dev_ino(__entry),
  543. __entry->pos,
  544. __entry->len,
  545. __entry->rw,
  546. __entry->ret)
  547. );
  548. TRACE_EVENT(f2fs_reserve_new_block,
  549. TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs_in_node),
  550. TP_ARGS(inode, nid, ofs_in_node),
  551. TP_STRUCT__entry(
  552. __field(dev_t, dev)
  553. __field(nid_t, nid)
  554. __field(unsigned int, ofs_in_node)
  555. ),
  556. TP_fast_assign(
  557. __entry->dev = inode->i_sb->s_dev;
  558. __entry->nid = nid;
  559. __entry->ofs_in_node = ofs_in_node;
  560. ),
  561. TP_printk("dev = (%d,%d), nid = %u, ofs_in_node = %u",
  562. show_dev(__entry),
  563. (unsigned int)__entry->nid,
  564. __entry->ofs_in_node)
  565. );
  566. DECLARE_EVENT_CLASS(f2fs__submit_page_bio,
  567. TP_PROTO(struct page *page, struct f2fs_io_info *fio),
  568. TP_ARGS(page, fio),
  569. TP_STRUCT__entry(
  570. __field(dev_t, dev)
  571. __field(ino_t, ino)
  572. __field(pgoff_t, index)
  573. __field(block_t, blkaddr)
  574. __field(int, rw)
  575. __field(int, type)
  576. ),
  577. TP_fast_assign(
  578. __entry->dev = page->mapping->host->i_sb->s_dev;
  579. __entry->ino = page->mapping->host->i_ino;
  580. __entry->index = page->index;
  581. __entry->blkaddr = fio->blk_addr;
  582. __entry->rw = fio->rw;
  583. __entry->type = fio->type;
  584. ),
  585. TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, "
  586. "blkaddr = 0x%llx, rw = %s%s, type = %s",
  587. show_dev_ino(__entry),
  588. (unsigned long)__entry->index,
  589. (unsigned long long)__entry->blkaddr,
  590. show_bio_type(__entry->rw),
  591. show_block_type(__entry->type))
  592. );
  593. DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_bio,
  594. TP_PROTO(struct page *page, struct f2fs_io_info *fio),
  595. TP_ARGS(page, fio),
  596. TP_CONDITION(page->mapping)
  597. );
  598. DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_mbio,
  599. TP_PROTO(struct page *page, struct f2fs_io_info *fio),
  600. TP_ARGS(page, fio),
  601. TP_CONDITION(page->mapping)
  602. );
  603. DECLARE_EVENT_CLASS(f2fs__submit_bio,
  604. TP_PROTO(struct super_block *sb, struct f2fs_io_info *fio,
  605. struct bio *bio),
  606. TP_ARGS(sb, fio, bio),
  607. TP_STRUCT__entry(
  608. __field(dev_t, dev)
  609. __field(int, rw)
  610. __field(int, type)
  611. __field(sector_t, sector)
  612. __field(unsigned int, size)
  613. ),
  614. TP_fast_assign(
  615. __entry->dev = sb->s_dev;
  616. __entry->rw = fio->rw;
  617. __entry->type = fio->type;
  618. __entry->sector = bio->bi_iter.bi_sector;
  619. __entry->size = bio->bi_iter.bi_size;
  620. ),
  621. TP_printk("dev = (%d,%d), %s%s, %s, sector = %lld, size = %u",
  622. show_dev(__entry),
  623. show_bio_type(__entry->rw),
  624. show_block_type(__entry->type),
  625. (unsigned long long)__entry->sector,
  626. __entry->size)
  627. );
  628. DEFINE_EVENT_CONDITION(f2fs__submit_bio, f2fs_submit_write_bio,
  629. TP_PROTO(struct super_block *sb, struct f2fs_io_info *fio,
  630. struct bio *bio),
  631. TP_ARGS(sb, fio, bio),
  632. TP_CONDITION(bio)
  633. );
  634. DEFINE_EVENT_CONDITION(f2fs__submit_bio, f2fs_submit_read_bio,
  635. TP_PROTO(struct super_block *sb, struct f2fs_io_info *fio,
  636. struct bio *bio),
  637. TP_ARGS(sb, fio, bio),
  638. TP_CONDITION(bio)
  639. );
  640. TRACE_EVENT(f2fs_write_begin,
  641. TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
  642. unsigned int flags),
  643. TP_ARGS(inode, pos, len, flags),
  644. TP_STRUCT__entry(
  645. __field(dev_t, dev)
  646. __field(ino_t, ino)
  647. __field(loff_t, pos)
  648. __field(unsigned int, len)
  649. __field(unsigned int, flags)
  650. ),
  651. TP_fast_assign(
  652. __entry->dev = inode->i_sb->s_dev;
  653. __entry->ino = inode->i_ino;
  654. __entry->pos = pos;
  655. __entry->len = len;
  656. __entry->flags = flags;
  657. ),
  658. TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, flags = %u",
  659. show_dev_ino(__entry),
  660. (unsigned long long)__entry->pos,
  661. __entry->len,
  662. __entry->flags)
  663. );
  664. TRACE_EVENT(f2fs_write_end,
  665. TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
  666. unsigned int copied),
  667. TP_ARGS(inode, pos, len, copied),
  668. TP_STRUCT__entry(
  669. __field(dev_t, dev)
  670. __field(ino_t, ino)
  671. __field(loff_t, pos)
  672. __field(unsigned int, len)
  673. __field(unsigned int, copied)
  674. ),
  675. TP_fast_assign(
  676. __entry->dev = inode->i_sb->s_dev;
  677. __entry->ino = inode->i_ino;
  678. __entry->pos = pos;
  679. __entry->len = len;
  680. __entry->copied = copied;
  681. ),
  682. TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, copied = %u",
  683. show_dev_ino(__entry),
  684. (unsigned long long)__entry->pos,
  685. __entry->len,
  686. __entry->copied)
  687. );
  688. DECLARE_EVENT_CLASS(f2fs__page,
  689. TP_PROTO(struct page *page, int type),
  690. TP_ARGS(page, type),
  691. TP_STRUCT__entry(
  692. __field(dev_t, dev)
  693. __field(ino_t, ino)
  694. __field(int, type)
  695. __field(int, dir)
  696. __field(pgoff_t, index)
  697. __field(int, dirty)
  698. __field(int, uptodate)
  699. ),
  700. TP_fast_assign(
  701. __entry->dev = page->mapping->host->i_sb->s_dev;
  702. __entry->ino = page->mapping->host->i_ino;
  703. __entry->type = type;
  704. __entry->dir = S_ISDIR(page->mapping->host->i_mode);
  705. __entry->index = page->index;
  706. __entry->dirty = PageDirty(page);
  707. __entry->uptodate = PageUptodate(page);
  708. ),
  709. TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, "
  710. "dirty = %d, uptodate = %d",
  711. show_dev_ino(__entry),
  712. show_block_type(__entry->type),
  713. show_file_type(__entry->dir),
  714. (unsigned long)__entry->index,
  715. __entry->dirty,
  716. __entry->uptodate)
  717. );
  718. DEFINE_EVENT(f2fs__page, f2fs_writepage,
  719. TP_PROTO(struct page *page, int type),
  720. TP_ARGS(page, type)
  721. );
  722. DEFINE_EVENT(f2fs__page, f2fs_do_write_data_page,
  723. TP_PROTO(struct page *page, int type),
  724. TP_ARGS(page, type)
  725. );
  726. DEFINE_EVENT(f2fs__page, f2fs_readpage,
  727. TP_PROTO(struct page *page, int type),
  728. TP_ARGS(page, type)
  729. );
  730. DEFINE_EVENT(f2fs__page, f2fs_set_page_dirty,
  731. TP_PROTO(struct page *page, int type),
  732. TP_ARGS(page, type)
  733. );
  734. DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite,
  735. TP_PROTO(struct page *page, int type),
  736. TP_ARGS(page, type)
  737. );
  738. DEFINE_EVENT(f2fs__page, f2fs_register_inmem_page,
  739. TP_PROTO(struct page *page, int type),
  740. TP_ARGS(page, type)
  741. );
  742. DEFINE_EVENT(f2fs__page, f2fs_commit_inmem_page,
  743. TP_PROTO(struct page *page, int type),
  744. TP_ARGS(page, type)
  745. );
  746. TRACE_EVENT(f2fs_writepages,
  747. TP_PROTO(struct inode *inode, struct writeback_control *wbc, int type),
  748. TP_ARGS(inode, wbc, type),
  749. TP_STRUCT__entry(
  750. __field(dev_t, dev)
  751. __field(ino_t, ino)
  752. __field(int, type)
  753. __field(int, dir)
  754. __field(long, nr_to_write)
  755. __field(long, pages_skipped)
  756. __field(loff_t, range_start)
  757. __field(loff_t, range_end)
  758. __field(pgoff_t, writeback_index)
  759. __field(int, sync_mode)
  760. __field(char, for_kupdate)
  761. __field(char, for_background)
  762. __field(char, tagged_writepages)
  763. __field(char, for_reclaim)
  764. __field(char, range_cyclic)
  765. __field(char, for_sync)
  766. ),
  767. TP_fast_assign(
  768. __entry->dev = inode->i_sb->s_dev;
  769. __entry->ino = inode->i_ino;
  770. __entry->type = type;
  771. __entry->dir = S_ISDIR(inode->i_mode);
  772. __entry->nr_to_write = wbc->nr_to_write;
  773. __entry->pages_skipped = wbc->pages_skipped;
  774. __entry->range_start = wbc->range_start;
  775. __entry->range_end = wbc->range_end;
  776. __entry->writeback_index = inode->i_mapping->writeback_index;
  777. __entry->sync_mode = wbc->sync_mode;
  778. __entry->for_kupdate = wbc->for_kupdate;
  779. __entry->for_background = wbc->for_background;
  780. __entry->tagged_writepages = wbc->tagged_writepages;
  781. __entry->for_reclaim = wbc->for_reclaim;
  782. __entry->range_cyclic = wbc->range_cyclic;
  783. __entry->for_sync = wbc->for_sync;
  784. ),
  785. TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, "
  786. "skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, "
  787. "kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u",
  788. show_dev_ino(__entry),
  789. show_block_type(__entry->type),
  790. show_file_type(__entry->dir),
  791. __entry->nr_to_write,
  792. __entry->pages_skipped,
  793. __entry->range_start,
  794. __entry->range_end,
  795. (unsigned long)__entry->writeback_index,
  796. __entry->sync_mode,
  797. __entry->for_kupdate,
  798. __entry->for_background,
  799. __entry->tagged_writepages,
  800. __entry->for_reclaim,
  801. __entry->range_cyclic,
  802. __entry->for_sync)
  803. );
  804. TRACE_EVENT(f2fs_readpages,
  805. TP_PROTO(struct inode *inode, struct page *page, unsigned int nrpage),
  806. TP_ARGS(inode, page, nrpage),
  807. TP_STRUCT__entry(
  808. __field(dev_t, dev)
  809. __field(ino_t, ino)
  810. __field(pgoff_t, start)
  811. __field(unsigned int, nrpage)
  812. ),
  813. TP_fast_assign(
  814. __entry->dev = inode->i_sb->s_dev;
  815. __entry->ino = inode->i_ino;
  816. __entry->start = page->index;
  817. __entry->nrpage = nrpage;
  818. ),
  819. TP_printk("dev = (%d,%d), ino = %lu, start = %lu nrpage = %u",
  820. show_dev_ino(__entry),
  821. (unsigned long)__entry->start,
  822. __entry->nrpage)
  823. );
  824. TRACE_EVENT(f2fs_write_checkpoint,
  825. TP_PROTO(struct super_block *sb, int reason, char *msg),
  826. TP_ARGS(sb, reason, msg),
  827. TP_STRUCT__entry(
  828. __field(dev_t, dev)
  829. __field(int, reason)
  830. __field(char *, msg)
  831. ),
  832. TP_fast_assign(
  833. __entry->dev = sb->s_dev;
  834. __entry->reason = reason;
  835. __entry->msg = msg;
  836. ),
  837. TP_printk("dev = (%d,%d), checkpoint for %s, state = %s",
  838. show_dev(__entry),
  839. show_cpreason(__entry->reason),
  840. __entry->msg)
  841. );
  842. TRACE_EVENT(f2fs_issue_discard,
  843. TP_PROTO(struct super_block *sb, block_t blkstart, block_t blklen),
  844. TP_ARGS(sb, blkstart, blklen),
  845. TP_STRUCT__entry(
  846. __field(dev_t, dev)
  847. __field(block_t, blkstart)
  848. __field(block_t, blklen)
  849. ),
  850. TP_fast_assign(
  851. __entry->dev = sb->s_dev;
  852. __entry->blkstart = blkstart;
  853. __entry->blklen = blklen;
  854. ),
  855. TP_printk("dev = (%d,%d), blkstart = 0x%llx, blklen = 0x%llx",
  856. show_dev(__entry),
  857. (unsigned long long)__entry->blkstart,
  858. (unsigned long long)__entry->blklen)
  859. );
  860. TRACE_EVENT(f2fs_issue_flush,
  861. TP_PROTO(struct super_block *sb, unsigned int nobarrier,
  862. unsigned int flush_merge),
  863. TP_ARGS(sb, nobarrier, flush_merge),
  864. TP_STRUCT__entry(
  865. __field(dev_t, dev)
  866. __field(unsigned int, nobarrier)
  867. __field(unsigned int, flush_merge)
  868. ),
  869. TP_fast_assign(
  870. __entry->dev = sb->s_dev;
  871. __entry->nobarrier = nobarrier;
  872. __entry->flush_merge = flush_merge;
  873. ),
  874. TP_printk("dev = (%d,%d), %s %s",
  875. show_dev(__entry),
  876. __entry->nobarrier ? "skip (nobarrier)" : "issue",
  877. __entry->flush_merge ? " with flush_merge" : "")
  878. );
  879. TRACE_EVENT(f2fs_lookup_extent_tree_start,
  880. TP_PROTO(struct inode *inode, unsigned int pgofs),
  881. TP_ARGS(inode, pgofs),
  882. TP_STRUCT__entry(
  883. __field(dev_t, dev)
  884. __field(ino_t, ino)
  885. __field(unsigned int, pgofs)
  886. ),
  887. TP_fast_assign(
  888. __entry->dev = inode->i_sb->s_dev;
  889. __entry->ino = inode->i_ino;
  890. __entry->pgofs = pgofs;
  891. ),
  892. TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u",
  893. show_dev_ino(__entry),
  894. __entry->pgofs)
  895. );
  896. TRACE_EVENT_CONDITION(f2fs_lookup_extent_tree_end,
  897. TP_PROTO(struct inode *inode, unsigned int pgofs,
  898. struct extent_info *ei),
  899. TP_ARGS(inode, pgofs, ei),
  900. TP_CONDITION(ei),
  901. TP_STRUCT__entry(
  902. __field(dev_t, dev)
  903. __field(ino_t, ino)
  904. __field(unsigned int, pgofs)
  905. __field(unsigned int, fofs)
  906. __field(u32, blk)
  907. __field(unsigned int, len)
  908. ),
  909. TP_fast_assign(
  910. __entry->dev = inode->i_sb->s_dev;
  911. __entry->ino = inode->i_ino;
  912. __entry->pgofs = pgofs;
  913. __entry->fofs = ei->fofs;
  914. __entry->blk = ei->blk;
  915. __entry->len = ei->len;
  916. ),
  917. TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
  918. "ext_info(fofs: %u, blk: %u, len: %u)",
  919. show_dev_ino(__entry),
  920. __entry->pgofs,
  921. __entry->fofs,
  922. __entry->blk,
  923. __entry->len)
  924. );
  925. TRACE_EVENT(f2fs_update_extent_tree_range,
  926. TP_PROTO(struct inode *inode, unsigned int pgofs, block_t blkaddr,
  927. unsigned int len),
  928. TP_ARGS(inode, pgofs, blkaddr, len),
  929. TP_STRUCT__entry(
  930. __field(dev_t, dev)
  931. __field(ino_t, ino)
  932. __field(unsigned int, pgofs)
  933. __field(u32, blk)
  934. __field(unsigned int, len)
  935. ),
  936. TP_fast_assign(
  937. __entry->dev = inode->i_sb->s_dev;
  938. __entry->ino = inode->i_ino;
  939. __entry->pgofs = pgofs;
  940. __entry->blk = blkaddr;
  941. __entry->len = len;
  942. ),
  943. TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
  944. "blkaddr = %u, len = %u",
  945. show_dev_ino(__entry),
  946. __entry->pgofs,
  947. __entry->blk,
  948. __entry->len)
  949. );
  950. TRACE_EVENT(f2fs_shrink_extent_tree,
  951. TP_PROTO(struct f2fs_sb_info *sbi, unsigned int node_cnt,
  952. unsigned int tree_cnt),
  953. TP_ARGS(sbi, node_cnt, tree_cnt),
  954. TP_STRUCT__entry(
  955. __field(dev_t, dev)
  956. __field(unsigned int, node_cnt)
  957. __field(unsigned int, tree_cnt)
  958. ),
  959. TP_fast_assign(
  960. __entry->dev = sbi->sb->s_dev;
  961. __entry->node_cnt = node_cnt;
  962. __entry->tree_cnt = tree_cnt;
  963. ),
  964. TP_printk("dev = (%d,%d), shrunk: node_cnt = %u, tree_cnt = %u",
  965. show_dev(__entry),
  966. __entry->node_cnt,
  967. __entry->tree_cnt)
  968. );
  969. TRACE_EVENT(f2fs_destroy_extent_tree,
  970. TP_PROTO(struct inode *inode, unsigned int node_cnt),
  971. TP_ARGS(inode, node_cnt),
  972. TP_STRUCT__entry(
  973. __field(dev_t, dev)
  974. __field(ino_t, ino)
  975. __field(unsigned int, node_cnt)
  976. ),
  977. TP_fast_assign(
  978. __entry->dev = inode->i_sb->s_dev;
  979. __entry->ino = inode->i_ino;
  980. __entry->node_cnt = node_cnt;
  981. ),
  982. TP_printk("dev = (%d,%d), ino = %lu, destroyed: node_cnt = %u",
  983. show_dev_ino(__entry),
  984. __entry->node_cnt)
  985. );
  986. #endif /* _TRACE_F2FS_H */
  987. /* This part must be outside protection */
  988. #include <trace/define_trace.h>