xfs_trace.h 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777
  1. /*
  2. * Copyright (c) 2009, Christoph Hellwig
  3. * All Rights Reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it would be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write the Free Software Foundation,
  16. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #undef TRACE_SYSTEM
  19. #define TRACE_SYSTEM xfs
  20. #if !defined(_TRACE_XFS_H) || defined(TRACE_HEADER_MULTI_READ)
  21. #define _TRACE_XFS_H
  22. #include <linux/tracepoint.h>
  23. struct xfs_agf;
  24. struct xfs_alloc_arg;
  25. struct xfs_attr_list_context;
  26. struct xfs_buf_log_item;
  27. struct xfs_da_args;
  28. struct xfs_da_node_entry;
  29. struct xfs_dquot;
  30. struct xlog_ticket;
  31. struct log;
  32. struct xlog_recover;
  33. struct xlog_recover_item;
  34. struct xfs_buf_log_format;
  35. struct xfs_inode_log_format;
  36. DECLARE_EVENT_CLASS(xfs_attr_list_class,
  37. TP_PROTO(struct xfs_attr_list_context *ctx),
  38. TP_ARGS(ctx),
  39. TP_STRUCT__entry(
  40. __field(dev_t, dev)
  41. __field(xfs_ino_t, ino)
  42. __field(u32, hashval)
  43. __field(u32, blkno)
  44. __field(u32, offset)
  45. __field(void *, alist)
  46. __field(int, bufsize)
  47. __field(int, count)
  48. __field(int, firstu)
  49. __field(int, dupcnt)
  50. __field(int, flags)
  51. ),
  52. TP_fast_assign(
  53. __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
  54. __entry->ino = ctx->dp->i_ino;
  55. __entry->hashval = ctx->cursor->hashval;
  56. __entry->blkno = ctx->cursor->blkno;
  57. __entry->offset = ctx->cursor->offset;
  58. __entry->alist = ctx->alist;
  59. __entry->bufsize = ctx->bufsize;
  60. __entry->count = ctx->count;
  61. __entry->firstu = ctx->firstu;
  62. __entry->flags = ctx->flags;
  63. ),
  64. TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
  65. "alist 0x%p size %u count %u firstu %u flags %d %s",
  66. MAJOR(__entry->dev), MINOR(__entry->dev),
  67. __entry->ino,
  68. __entry->hashval,
  69. __entry->blkno,
  70. __entry->offset,
  71. __entry->dupcnt,
  72. __entry->alist,
  73. __entry->bufsize,
  74. __entry->count,
  75. __entry->firstu,
  76. __entry->flags,
  77. __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS)
  78. )
  79. )
  80. #define DEFINE_ATTR_LIST_EVENT(name) \
  81. DEFINE_EVENT(xfs_attr_list_class, name, \
  82. TP_PROTO(struct xfs_attr_list_context *ctx), \
  83. TP_ARGS(ctx))
  84. DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
  85. DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
  86. DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
  87. DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end);
  88. DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
  89. DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
  90. DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
  91. DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
  92. DECLARE_EVENT_CLASS(xfs_perag_class,
  93. TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,
  94. unsigned long caller_ip),
  95. TP_ARGS(mp, agno, refcount, caller_ip),
  96. TP_STRUCT__entry(
  97. __field(dev_t, dev)
  98. __field(xfs_agnumber_t, agno)
  99. __field(int, refcount)
  100. __field(unsigned long, caller_ip)
  101. ),
  102. TP_fast_assign(
  103. __entry->dev = mp->m_super->s_dev;
  104. __entry->agno = agno;
  105. __entry->refcount = refcount;
  106. __entry->caller_ip = caller_ip;
  107. ),
  108. TP_printk("dev %d:%d agno %u refcount %d caller %pf",
  109. MAJOR(__entry->dev), MINOR(__entry->dev),
  110. __entry->agno,
  111. __entry->refcount,
  112. (char *)__entry->caller_ip)
  113. );
  114. #define DEFINE_PERAG_REF_EVENT(name) \
  115. DEFINE_EVENT(xfs_perag_class, name, \
  116. TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount, \
  117. unsigned long caller_ip), \
  118. TP_ARGS(mp, agno, refcount, caller_ip))
  119. DEFINE_PERAG_REF_EVENT(xfs_perag_get);
  120. DEFINE_PERAG_REF_EVENT(xfs_perag_get_tag);
  121. DEFINE_PERAG_REF_EVENT(xfs_perag_put);
  122. DEFINE_PERAG_REF_EVENT(xfs_perag_set_reclaim);
  123. DEFINE_PERAG_REF_EVENT(xfs_perag_clear_reclaim);
  124. TRACE_EVENT(xfs_attr_list_node_descend,
  125. TP_PROTO(struct xfs_attr_list_context *ctx,
  126. struct xfs_da_node_entry *btree),
  127. TP_ARGS(ctx, btree),
  128. TP_STRUCT__entry(
  129. __field(dev_t, dev)
  130. __field(xfs_ino_t, ino)
  131. __field(u32, hashval)
  132. __field(u32, blkno)
  133. __field(u32, offset)
  134. __field(void *, alist)
  135. __field(int, bufsize)
  136. __field(int, count)
  137. __field(int, firstu)
  138. __field(int, dupcnt)
  139. __field(int, flags)
  140. __field(u32, bt_hashval)
  141. __field(u32, bt_before)
  142. ),
  143. TP_fast_assign(
  144. __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
  145. __entry->ino = ctx->dp->i_ino;
  146. __entry->hashval = ctx->cursor->hashval;
  147. __entry->blkno = ctx->cursor->blkno;
  148. __entry->offset = ctx->cursor->offset;
  149. __entry->alist = ctx->alist;
  150. __entry->bufsize = ctx->bufsize;
  151. __entry->count = ctx->count;
  152. __entry->firstu = ctx->firstu;
  153. __entry->flags = ctx->flags;
  154. __entry->bt_hashval = be32_to_cpu(btree->hashval);
  155. __entry->bt_before = be32_to_cpu(btree->before);
  156. ),
  157. TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
  158. "alist 0x%p size %u count %u firstu %u flags %d %s "
  159. "node hashval %u, node before %u",
  160. MAJOR(__entry->dev), MINOR(__entry->dev),
  161. __entry->ino,
  162. __entry->hashval,
  163. __entry->blkno,
  164. __entry->offset,
  165. __entry->dupcnt,
  166. __entry->alist,
  167. __entry->bufsize,
  168. __entry->count,
  169. __entry->firstu,
  170. __entry->flags,
  171. __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS),
  172. __entry->bt_hashval,
  173. __entry->bt_before)
  174. );
  175. TRACE_EVENT(xfs_iext_insert,
  176. TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx,
  177. struct xfs_bmbt_irec *r, int state, unsigned long caller_ip),
  178. TP_ARGS(ip, idx, r, state, caller_ip),
  179. TP_STRUCT__entry(
  180. __field(dev_t, dev)
  181. __field(xfs_ino_t, ino)
  182. __field(xfs_extnum_t, idx)
  183. __field(xfs_fileoff_t, startoff)
  184. __field(xfs_fsblock_t, startblock)
  185. __field(xfs_filblks_t, blockcount)
  186. __field(xfs_exntst_t, state)
  187. __field(int, bmap_state)
  188. __field(unsigned long, caller_ip)
  189. ),
  190. TP_fast_assign(
  191. __entry->dev = VFS_I(ip)->i_sb->s_dev;
  192. __entry->ino = ip->i_ino;
  193. __entry->idx = idx;
  194. __entry->startoff = r->br_startoff;
  195. __entry->startblock = r->br_startblock;
  196. __entry->blockcount = r->br_blockcount;
  197. __entry->state = r->br_state;
  198. __entry->bmap_state = state;
  199. __entry->caller_ip = caller_ip;
  200. ),
  201. TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
  202. "offset %lld block %lld count %lld flag %d caller %pf",
  203. MAJOR(__entry->dev), MINOR(__entry->dev),
  204. __entry->ino,
  205. __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
  206. (long)__entry->idx,
  207. __entry->startoff,
  208. (__int64_t)__entry->startblock,
  209. __entry->blockcount,
  210. __entry->state,
  211. (char *)__entry->caller_ip)
  212. );
  213. DECLARE_EVENT_CLASS(xfs_bmap_class,
  214. TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state,
  215. unsigned long caller_ip),
  216. TP_ARGS(ip, idx, state, caller_ip),
  217. TP_STRUCT__entry(
  218. __field(dev_t, dev)
  219. __field(xfs_ino_t, ino)
  220. __field(xfs_extnum_t, idx)
  221. __field(xfs_fileoff_t, startoff)
  222. __field(xfs_fsblock_t, startblock)
  223. __field(xfs_filblks_t, blockcount)
  224. __field(xfs_exntst_t, state)
  225. __field(int, bmap_state)
  226. __field(unsigned long, caller_ip)
  227. ),
  228. TP_fast_assign(
  229. struct xfs_ifork *ifp = (state & BMAP_ATTRFORK) ?
  230. ip->i_afp : &ip->i_df;
  231. struct xfs_bmbt_irec r;
  232. xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &r);
  233. __entry->dev = VFS_I(ip)->i_sb->s_dev;
  234. __entry->ino = ip->i_ino;
  235. __entry->idx = idx;
  236. __entry->startoff = r.br_startoff;
  237. __entry->startblock = r.br_startblock;
  238. __entry->blockcount = r.br_blockcount;
  239. __entry->state = r.br_state;
  240. __entry->bmap_state = state;
  241. __entry->caller_ip = caller_ip;
  242. ),
  243. TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
  244. "offset %lld block %lld count %lld flag %d caller %pf",
  245. MAJOR(__entry->dev), MINOR(__entry->dev),
  246. __entry->ino,
  247. __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
  248. (long)__entry->idx,
  249. __entry->startoff,
  250. (__int64_t)__entry->startblock,
  251. __entry->blockcount,
  252. __entry->state,
  253. (char *)__entry->caller_ip)
  254. )
  255. #define DEFINE_BMAP_EVENT(name) \
  256. DEFINE_EVENT(xfs_bmap_class, name, \
  257. TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state, \
  258. unsigned long caller_ip), \
  259. TP_ARGS(ip, idx, state, caller_ip))
  260. DEFINE_BMAP_EVENT(xfs_iext_remove);
  261. DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
  262. DEFINE_BMAP_EVENT(xfs_bmap_post_update);
  263. DEFINE_BMAP_EVENT(xfs_extlist);
  264. DECLARE_EVENT_CLASS(xfs_buf_class,
  265. TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
  266. TP_ARGS(bp, caller_ip),
  267. TP_STRUCT__entry(
  268. __field(dev_t, dev)
  269. __field(xfs_daddr_t, bno)
  270. __field(size_t, buffer_length)
  271. __field(int, hold)
  272. __field(int, pincount)
  273. __field(unsigned, lockval)
  274. __field(unsigned, flags)
  275. __field(unsigned long, caller_ip)
  276. ),
  277. TP_fast_assign(
  278. __entry->dev = bp->b_target->bt_dev;
  279. __entry->bno = bp->b_bn;
  280. __entry->buffer_length = bp->b_buffer_length;
  281. __entry->hold = atomic_read(&bp->b_hold);
  282. __entry->pincount = atomic_read(&bp->b_pin_count);
  283. __entry->lockval = xfs_buf_lock_value(bp);
  284. __entry->flags = bp->b_flags;
  285. __entry->caller_ip = caller_ip;
  286. ),
  287. TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
  288. "lock %d flags %s caller %pf",
  289. MAJOR(__entry->dev), MINOR(__entry->dev),
  290. (unsigned long long)__entry->bno,
  291. __entry->buffer_length,
  292. __entry->hold,
  293. __entry->pincount,
  294. __entry->lockval,
  295. __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
  296. (void *)__entry->caller_ip)
  297. )
  298. #define DEFINE_BUF_EVENT(name) \
  299. DEFINE_EVENT(xfs_buf_class, name, \
  300. TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
  301. TP_ARGS(bp, caller_ip))
  302. DEFINE_BUF_EVENT(xfs_buf_init);
  303. DEFINE_BUF_EVENT(xfs_buf_free);
  304. DEFINE_BUF_EVENT(xfs_buf_hold);
  305. DEFINE_BUF_EVENT(xfs_buf_rele);
  306. DEFINE_BUF_EVENT(xfs_buf_iodone);
  307. DEFINE_BUF_EVENT(xfs_buf_iorequest);
  308. DEFINE_BUF_EVENT(xfs_buf_bawrite);
  309. DEFINE_BUF_EVENT(xfs_buf_bdwrite);
  310. DEFINE_BUF_EVENT(xfs_buf_lock);
  311. DEFINE_BUF_EVENT(xfs_buf_lock_done);
  312. DEFINE_BUF_EVENT(xfs_buf_cond_lock);
  313. DEFINE_BUF_EVENT(xfs_buf_unlock);
  314. DEFINE_BUF_EVENT(xfs_buf_iowait);
  315. DEFINE_BUF_EVENT(xfs_buf_iowait_done);
  316. DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
  317. DEFINE_BUF_EVENT(xfs_buf_delwri_dequeue);
  318. DEFINE_BUF_EVENT(xfs_buf_delwri_split);
  319. DEFINE_BUF_EVENT(xfs_buf_get_uncached);
  320. DEFINE_BUF_EVENT(xfs_bdstrat_shut);
  321. DEFINE_BUF_EVENT(xfs_buf_item_relse);
  322. DEFINE_BUF_EVENT(xfs_buf_item_iodone);
  323. DEFINE_BUF_EVENT(xfs_buf_item_iodone_async);
  324. DEFINE_BUF_EVENT(xfs_buf_error_relse);
  325. DEFINE_BUF_EVENT(xfs_trans_read_buf_io);
  326. DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
  327. /* not really buffer traces, but the buf provides useful information */
  328. DEFINE_BUF_EVENT(xfs_btree_corrupt);
  329. DEFINE_BUF_EVENT(xfs_da_btree_corrupt);
  330. DEFINE_BUF_EVENT(xfs_reset_dqcounts);
  331. DEFINE_BUF_EVENT(xfs_inode_item_push);
  332. /* pass flags explicitly */
  333. DECLARE_EVENT_CLASS(xfs_buf_flags_class,
  334. TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
  335. TP_ARGS(bp, flags, caller_ip),
  336. TP_STRUCT__entry(
  337. __field(dev_t, dev)
  338. __field(xfs_daddr_t, bno)
  339. __field(size_t, buffer_length)
  340. __field(int, hold)
  341. __field(int, pincount)
  342. __field(unsigned, lockval)
  343. __field(unsigned, flags)
  344. __field(unsigned long, caller_ip)
  345. ),
  346. TP_fast_assign(
  347. __entry->dev = bp->b_target->bt_dev;
  348. __entry->bno = bp->b_bn;
  349. __entry->buffer_length = bp->b_buffer_length;
  350. __entry->flags = flags;
  351. __entry->hold = atomic_read(&bp->b_hold);
  352. __entry->pincount = atomic_read(&bp->b_pin_count);
  353. __entry->lockval = xfs_buf_lock_value(bp);
  354. __entry->caller_ip = caller_ip;
  355. ),
  356. TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
  357. "lock %d flags %s caller %pf",
  358. MAJOR(__entry->dev), MINOR(__entry->dev),
  359. (unsigned long long)__entry->bno,
  360. __entry->buffer_length,
  361. __entry->hold,
  362. __entry->pincount,
  363. __entry->lockval,
  364. __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
  365. (void *)__entry->caller_ip)
  366. )
  367. #define DEFINE_BUF_FLAGS_EVENT(name) \
  368. DEFINE_EVENT(xfs_buf_flags_class, name, \
  369. TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
  370. TP_ARGS(bp, flags, caller_ip))
  371. DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
  372. DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
  373. DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
  374. TRACE_EVENT(xfs_buf_ioerror,
  375. TP_PROTO(struct xfs_buf *bp, int error, unsigned long caller_ip),
  376. TP_ARGS(bp, error, caller_ip),
  377. TP_STRUCT__entry(
  378. __field(dev_t, dev)
  379. __field(xfs_daddr_t, bno)
  380. __field(size_t, buffer_length)
  381. __field(unsigned, flags)
  382. __field(int, hold)
  383. __field(int, pincount)
  384. __field(unsigned, lockval)
  385. __field(int, error)
  386. __field(unsigned long, caller_ip)
  387. ),
  388. TP_fast_assign(
  389. __entry->dev = bp->b_target->bt_dev;
  390. __entry->bno = bp->b_bn;
  391. __entry->buffer_length = bp->b_buffer_length;
  392. __entry->hold = atomic_read(&bp->b_hold);
  393. __entry->pincount = atomic_read(&bp->b_pin_count);
  394. __entry->lockval = xfs_buf_lock_value(bp);
  395. __entry->error = error;
  396. __entry->flags = bp->b_flags;
  397. __entry->caller_ip = caller_ip;
  398. ),
  399. TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
  400. "lock %d error %d flags %s caller %pf",
  401. MAJOR(__entry->dev), MINOR(__entry->dev),
  402. (unsigned long long)__entry->bno,
  403. __entry->buffer_length,
  404. __entry->hold,
  405. __entry->pincount,
  406. __entry->lockval,
  407. __entry->error,
  408. __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
  409. (void *)__entry->caller_ip)
  410. );
  411. DECLARE_EVENT_CLASS(xfs_buf_item_class,
  412. TP_PROTO(struct xfs_buf_log_item *bip),
  413. TP_ARGS(bip),
  414. TP_STRUCT__entry(
  415. __field(dev_t, dev)
  416. __field(xfs_daddr_t, buf_bno)
  417. __field(size_t, buf_len)
  418. __field(int, buf_hold)
  419. __field(int, buf_pincount)
  420. __field(int, buf_lockval)
  421. __field(unsigned, buf_flags)
  422. __field(unsigned, bli_recur)
  423. __field(int, bli_refcount)
  424. __field(unsigned, bli_flags)
  425. __field(void *, li_desc)
  426. __field(unsigned, li_flags)
  427. ),
  428. TP_fast_assign(
  429. __entry->dev = bip->bli_buf->b_target->bt_dev;
  430. __entry->bli_flags = bip->bli_flags;
  431. __entry->bli_recur = bip->bli_recur;
  432. __entry->bli_refcount = atomic_read(&bip->bli_refcount);
  433. __entry->buf_bno = bip->bli_buf->b_bn;
  434. __entry->buf_len = bip->bli_buf->b_buffer_length;
  435. __entry->buf_flags = bip->bli_buf->b_flags;
  436. __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
  437. __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
  438. __entry->buf_lockval = xfs_buf_lock_value(bip->bli_buf);
  439. __entry->li_desc = bip->bli_item.li_desc;
  440. __entry->li_flags = bip->bli_item.li_flags;
  441. ),
  442. TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
  443. "lock %d flags %s recur %d refcount %d bliflags %s "
  444. "lidesc 0x%p liflags %s",
  445. MAJOR(__entry->dev), MINOR(__entry->dev),
  446. (unsigned long long)__entry->buf_bno,
  447. __entry->buf_len,
  448. __entry->buf_hold,
  449. __entry->buf_pincount,
  450. __entry->buf_lockval,
  451. __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
  452. __entry->bli_recur,
  453. __entry->bli_refcount,
  454. __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
  455. __entry->li_desc,
  456. __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
  457. )
  458. #define DEFINE_BUF_ITEM_EVENT(name) \
  459. DEFINE_EVENT(xfs_buf_item_class, name, \
  460. TP_PROTO(struct xfs_buf_log_item *bip), \
  461. TP_ARGS(bip))
  462. DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
  463. DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
  464. DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
  465. DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
  466. DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
  467. DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
  468. DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
  469. DEFINE_BUF_ITEM_EVENT(xfs_buf_item_trylock);
  470. DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock);
  471. DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock_stale);
  472. DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
  473. DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
  474. DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pushbuf);
  475. DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
  476. DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
  477. DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
  478. DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
  479. DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
  480. DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
  481. DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
  482. DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
  483. DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
  484. DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
  485. DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
  486. DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
  487. DECLARE_EVENT_CLASS(xfs_lock_class,
  488. TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
  489. unsigned long caller_ip),
  490. TP_ARGS(ip, lock_flags, caller_ip),
  491. TP_STRUCT__entry(
  492. __field(dev_t, dev)
  493. __field(xfs_ino_t, ino)
  494. __field(int, lock_flags)
  495. __field(unsigned long, caller_ip)
  496. ),
  497. TP_fast_assign(
  498. __entry->dev = VFS_I(ip)->i_sb->s_dev;
  499. __entry->ino = ip->i_ino;
  500. __entry->lock_flags = lock_flags;
  501. __entry->caller_ip = caller_ip;
  502. ),
  503. TP_printk("dev %d:%d ino 0x%llx flags %s caller %pf",
  504. MAJOR(__entry->dev), MINOR(__entry->dev),
  505. __entry->ino,
  506. __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
  507. (void *)__entry->caller_ip)
  508. )
  509. #define DEFINE_LOCK_EVENT(name) \
  510. DEFINE_EVENT(xfs_lock_class, name, \
  511. TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
  512. unsigned long caller_ip), \
  513. TP_ARGS(ip, lock_flags, caller_ip))
  514. DEFINE_LOCK_EVENT(xfs_ilock);
  515. DEFINE_LOCK_EVENT(xfs_ilock_nowait);
  516. DEFINE_LOCK_EVENT(xfs_ilock_demote);
  517. DEFINE_LOCK_EVENT(xfs_iunlock);
  518. DECLARE_EVENT_CLASS(xfs_inode_class,
  519. TP_PROTO(struct xfs_inode *ip),
  520. TP_ARGS(ip),
  521. TP_STRUCT__entry(
  522. __field(dev_t, dev)
  523. __field(xfs_ino_t, ino)
  524. ),
  525. TP_fast_assign(
  526. __entry->dev = VFS_I(ip)->i_sb->s_dev;
  527. __entry->ino = ip->i_ino;
  528. ),
  529. TP_printk("dev %d:%d ino 0x%llx",
  530. MAJOR(__entry->dev), MINOR(__entry->dev),
  531. __entry->ino)
  532. )
  533. #define DEFINE_INODE_EVENT(name) \
  534. DEFINE_EVENT(xfs_inode_class, name, \
  535. TP_PROTO(struct xfs_inode *ip), \
  536. TP_ARGS(ip))
  537. DEFINE_INODE_EVENT(xfs_iget_skip);
  538. DEFINE_INODE_EVENT(xfs_iget_reclaim);
  539. DEFINE_INODE_EVENT(xfs_iget_reclaim_fail);
  540. DEFINE_INODE_EVENT(xfs_iget_hit);
  541. DEFINE_INODE_EVENT(xfs_iget_miss);
  542. DEFINE_INODE_EVENT(xfs_getattr);
  543. DEFINE_INODE_EVENT(xfs_setattr);
  544. DEFINE_INODE_EVENT(xfs_readlink);
  545. DEFINE_INODE_EVENT(xfs_alloc_file_space);
  546. DEFINE_INODE_EVENT(xfs_free_file_space);
  547. DEFINE_INODE_EVENT(xfs_readdir);
  548. #ifdef CONFIG_XFS_POSIX_ACL
  549. DEFINE_INODE_EVENT(xfs_check_acl);
  550. #endif
  551. DEFINE_INODE_EVENT(xfs_vm_bmap);
  552. DEFINE_INODE_EVENT(xfs_file_ioctl);
  553. DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
  554. DEFINE_INODE_EVENT(xfs_ioctl_setattr);
  555. DEFINE_INODE_EVENT(xfs_file_fsync);
  556. DEFINE_INODE_EVENT(xfs_destroy_inode);
  557. DEFINE_INODE_EVENT(xfs_write_inode);
  558. DEFINE_INODE_EVENT(xfs_evict_inode);
  559. DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
  560. DEFINE_INODE_EVENT(xfs_dquot_dqdetach);
  561. DECLARE_EVENT_CLASS(xfs_iref_class,
  562. TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
  563. TP_ARGS(ip, caller_ip),
  564. TP_STRUCT__entry(
  565. __field(dev_t, dev)
  566. __field(xfs_ino_t, ino)
  567. __field(int, count)
  568. __field(int, pincount)
  569. __field(unsigned long, caller_ip)
  570. ),
  571. TP_fast_assign(
  572. __entry->dev = VFS_I(ip)->i_sb->s_dev;
  573. __entry->ino = ip->i_ino;
  574. __entry->count = atomic_read(&VFS_I(ip)->i_count);
  575. __entry->pincount = atomic_read(&ip->i_pincount);
  576. __entry->caller_ip = caller_ip;
  577. ),
  578. TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pf",
  579. MAJOR(__entry->dev), MINOR(__entry->dev),
  580. __entry->ino,
  581. __entry->count,
  582. __entry->pincount,
  583. (char *)__entry->caller_ip)
  584. )
  585. #define DEFINE_IREF_EVENT(name) \
  586. DEFINE_EVENT(xfs_iref_class, name, \
  587. TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
  588. TP_ARGS(ip, caller_ip))
  589. DEFINE_IREF_EVENT(xfs_ihold);
  590. DEFINE_IREF_EVENT(xfs_irele);
  591. DEFINE_IREF_EVENT(xfs_inode_pin);
  592. DEFINE_IREF_EVENT(xfs_inode_unpin);
  593. DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
  594. DECLARE_EVENT_CLASS(xfs_namespace_class,
  595. TP_PROTO(struct xfs_inode *dp, struct xfs_name *name),
  596. TP_ARGS(dp, name),
  597. TP_STRUCT__entry(
  598. __field(dev_t, dev)
  599. __field(xfs_ino_t, dp_ino)
  600. __dynamic_array(char, name, name->len)
  601. ),
  602. TP_fast_assign(
  603. __entry->dev = VFS_I(dp)->i_sb->s_dev;
  604. __entry->dp_ino = dp->i_ino;
  605. memcpy(__get_str(name), name->name, name->len);
  606. ),
  607. TP_printk("dev %d:%d dp ino 0x%llx name %s",
  608. MAJOR(__entry->dev), MINOR(__entry->dev),
  609. __entry->dp_ino,
  610. __get_str(name))
  611. )
  612. #define DEFINE_NAMESPACE_EVENT(name) \
  613. DEFINE_EVENT(xfs_namespace_class, name, \
  614. TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), \
  615. TP_ARGS(dp, name))
  616. DEFINE_NAMESPACE_EVENT(xfs_remove);
  617. DEFINE_NAMESPACE_EVENT(xfs_link);
  618. DEFINE_NAMESPACE_EVENT(xfs_lookup);
  619. DEFINE_NAMESPACE_EVENT(xfs_create);
  620. DEFINE_NAMESPACE_EVENT(xfs_symlink);
  621. TRACE_EVENT(xfs_rename,
  622. TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
  623. struct xfs_name *src_name, struct xfs_name *target_name),
  624. TP_ARGS(src_dp, target_dp, src_name, target_name),
  625. TP_STRUCT__entry(
  626. __field(dev_t, dev)
  627. __field(xfs_ino_t, src_dp_ino)
  628. __field(xfs_ino_t, target_dp_ino)
  629. __dynamic_array(char, src_name, src_name->len)
  630. __dynamic_array(char, target_name, target_name->len)
  631. ),
  632. TP_fast_assign(
  633. __entry->dev = VFS_I(src_dp)->i_sb->s_dev;
  634. __entry->src_dp_ino = src_dp->i_ino;
  635. __entry->target_dp_ino = target_dp->i_ino;
  636. memcpy(__get_str(src_name), src_name->name, src_name->len);
  637. memcpy(__get_str(target_name), target_name->name, target_name->len);
  638. ),
  639. TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
  640. " src name %s target name %s",
  641. MAJOR(__entry->dev), MINOR(__entry->dev),
  642. __entry->src_dp_ino,
  643. __entry->target_dp_ino,
  644. __get_str(src_name),
  645. __get_str(target_name))
  646. )
  647. DECLARE_EVENT_CLASS(xfs_dquot_class,
  648. TP_PROTO(struct xfs_dquot *dqp),
  649. TP_ARGS(dqp),
  650. TP_STRUCT__entry(
  651. __field(dev_t, dev)
  652. __field(u32, id)
  653. __field(unsigned, flags)
  654. __field(unsigned, nrefs)
  655. __field(unsigned long long, res_bcount)
  656. __field(unsigned long long, bcount)
  657. __field(unsigned long long, icount)
  658. __field(unsigned long long, blk_hardlimit)
  659. __field(unsigned long long, blk_softlimit)
  660. __field(unsigned long long, ino_hardlimit)
  661. __field(unsigned long long, ino_softlimit)
  662. ), \
  663. TP_fast_assign(
  664. __entry->dev = dqp->q_mount->m_super->s_dev;
  665. __entry->id = be32_to_cpu(dqp->q_core.d_id);
  666. __entry->flags = dqp->dq_flags;
  667. __entry->nrefs = dqp->q_nrefs;
  668. __entry->res_bcount = dqp->q_res_bcount;
  669. __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
  670. __entry->icount = be64_to_cpu(dqp->q_core.d_icount);
  671. __entry->blk_hardlimit =
  672. be64_to_cpu(dqp->q_core.d_blk_hardlimit);
  673. __entry->blk_softlimit =
  674. be64_to_cpu(dqp->q_core.d_blk_softlimit);
  675. __entry->ino_hardlimit =
  676. be64_to_cpu(dqp->q_core.d_ino_hardlimit);
  677. __entry->ino_softlimit =
  678. be64_to_cpu(dqp->q_core.d_ino_softlimit);
  679. ),
  680. TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
  681. "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
  682. "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
  683. MAJOR(__entry->dev), MINOR(__entry->dev),
  684. __entry->id,
  685. __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
  686. __entry->nrefs,
  687. __entry->res_bcount,
  688. __entry->bcount,
  689. __entry->blk_hardlimit,
  690. __entry->blk_softlimit,
  691. __entry->icount,
  692. __entry->ino_hardlimit,
  693. __entry->ino_softlimit)
  694. )
  695. #define DEFINE_DQUOT_EVENT(name) \
  696. DEFINE_EVENT(xfs_dquot_class, name, \
  697. TP_PROTO(struct xfs_dquot *dqp), \
  698. TP_ARGS(dqp))
  699. DEFINE_DQUOT_EVENT(xfs_dqadjust);
  700. DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
  701. DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
  702. DEFINE_DQUOT_EVENT(xfs_dqreclaim_unlink);
  703. DEFINE_DQUOT_EVENT(xfs_dqattach_found);
  704. DEFINE_DQUOT_EVENT(xfs_dqattach_get);
  705. DEFINE_DQUOT_EVENT(xfs_dqinit);
  706. DEFINE_DQUOT_EVENT(xfs_dqreuse);
  707. DEFINE_DQUOT_EVENT(xfs_dqalloc);
  708. DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
  709. DEFINE_DQUOT_EVENT(xfs_dqread);
  710. DEFINE_DQUOT_EVENT(xfs_dqread_fail);
  711. DEFINE_DQUOT_EVENT(xfs_dqlookup_found);
  712. DEFINE_DQUOT_EVENT(xfs_dqlookup_want);
  713. DEFINE_DQUOT_EVENT(xfs_dqlookup_freelist);
  714. DEFINE_DQUOT_EVENT(xfs_dqlookup_done);
  715. DEFINE_DQUOT_EVENT(xfs_dqget_hit);
  716. DEFINE_DQUOT_EVENT(xfs_dqget_miss);
  717. DEFINE_DQUOT_EVENT(xfs_dqput);
  718. DEFINE_DQUOT_EVENT(xfs_dqput_wait);
  719. DEFINE_DQUOT_EVENT(xfs_dqput_free);
  720. DEFINE_DQUOT_EVENT(xfs_dqrele);
  721. DEFINE_DQUOT_EVENT(xfs_dqflush);
  722. DEFINE_DQUOT_EVENT(xfs_dqflush_force);
  723. DEFINE_DQUOT_EVENT(xfs_dqflush_done);
  724. DECLARE_EVENT_CLASS(xfs_loggrant_class,
  725. TP_PROTO(struct log *log, struct xlog_ticket *tic),
  726. TP_ARGS(log, tic),
  727. TP_STRUCT__entry(
  728. __field(dev_t, dev)
  729. __field(unsigned, trans_type)
  730. __field(char, ocnt)
  731. __field(char, cnt)
  732. __field(int, curr_res)
  733. __field(int, unit_res)
  734. __field(unsigned int, flags)
  735. __field(int, reserveq)
  736. __field(int, writeq)
  737. __field(int, grant_reserve_cycle)
  738. __field(int, grant_reserve_bytes)
  739. __field(int, grant_write_cycle)
  740. __field(int, grant_write_bytes)
  741. __field(int, curr_cycle)
  742. __field(int, curr_block)
  743. __field(xfs_lsn_t, tail_lsn)
  744. ),
  745. TP_fast_assign(
  746. __entry->dev = log->l_mp->m_super->s_dev;
  747. __entry->trans_type = tic->t_trans_type;
  748. __entry->ocnt = tic->t_ocnt;
  749. __entry->cnt = tic->t_cnt;
  750. __entry->curr_res = tic->t_curr_res;
  751. __entry->unit_res = tic->t_unit_res;
  752. __entry->flags = tic->t_flags;
  753. __entry->reserveq = list_empty(&log->l_reserveq);
  754. __entry->writeq = list_empty(&log->l_writeq);
  755. xlog_crack_grant_head(&log->l_grant_reserve_head,
  756. &__entry->grant_reserve_cycle,
  757. &__entry->grant_reserve_bytes);
  758. xlog_crack_grant_head(&log->l_grant_write_head,
  759. &__entry->grant_write_cycle,
  760. &__entry->grant_write_bytes);
  761. __entry->curr_cycle = log->l_curr_cycle;
  762. __entry->curr_block = log->l_curr_block;
  763. __entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
  764. ),
  765. TP_printk("dev %d:%d type %s t_ocnt %u t_cnt %u t_curr_res %u "
  766. "t_unit_res %u t_flags %s reserveq %s "
  767. "writeq %s grant_reserve_cycle %d "
  768. "grant_reserve_bytes %d grant_write_cycle %d "
  769. "grant_write_bytes %d curr_cycle %d curr_block %d "
  770. "tail_cycle %d tail_block %d",
  771. MAJOR(__entry->dev), MINOR(__entry->dev),
  772. __print_symbolic(__entry->trans_type, XFS_TRANS_TYPES),
  773. __entry->ocnt,
  774. __entry->cnt,
  775. __entry->curr_res,
  776. __entry->unit_res,
  777. __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
  778. __entry->reserveq ? "empty" : "active",
  779. __entry->writeq ? "empty" : "active",
  780. __entry->grant_reserve_cycle,
  781. __entry->grant_reserve_bytes,
  782. __entry->grant_write_cycle,
  783. __entry->grant_write_bytes,
  784. __entry->curr_cycle,
  785. __entry->curr_block,
  786. CYCLE_LSN(__entry->tail_lsn),
  787. BLOCK_LSN(__entry->tail_lsn)
  788. )
  789. )
  790. #define DEFINE_LOGGRANT_EVENT(name) \
  791. DEFINE_EVENT(xfs_loggrant_class, name, \
  792. TP_PROTO(struct log *log, struct xlog_ticket *tic), \
  793. TP_ARGS(log, tic))
  794. DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
  795. DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
  796. DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
  797. DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
  798. DEFINE_LOGGRANT_EVENT(xfs_log_grant_enter);
  799. DEFINE_LOGGRANT_EVENT(xfs_log_grant_exit);
  800. DEFINE_LOGGRANT_EVENT(xfs_log_grant_error);
  801. DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep1);
  802. DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake1);
  803. DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep2);
  804. DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake2);
  805. DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
  806. DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_enter);
  807. DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_exit);
  808. DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_error);
  809. DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_sleep1);
  810. DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake1);
  811. DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_sleep2);
  812. DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake2);
  813. DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake_up);
  814. DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
  815. DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
  816. DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
  817. DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
  818. DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
  819. DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
  820. DECLARE_EVENT_CLASS(xfs_file_class,
  821. TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags),
  822. TP_ARGS(ip, count, offset, flags),
  823. TP_STRUCT__entry(
  824. __field(dev_t, dev)
  825. __field(xfs_ino_t, ino)
  826. __field(xfs_fsize_t, size)
  827. __field(xfs_fsize_t, new_size)
  828. __field(loff_t, offset)
  829. __field(size_t, count)
  830. __field(int, flags)
  831. ),
  832. TP_fast_assign(
  833. __entry->dev = VFS_I(ip)->i_sb->s_dev;
  834. __entry->ino = ip->i_ino;
  835. __entry->size = ip->i_d.di_size;
  836. __entry->new_size = ip->i_new_size;
  837. __entry->offset = offset;
  838. __entry->count = count;
  839. __entry->flags = flags;
  840. ),
  841. TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx "
  842. "offset 0x%llx count 0x%zx ioflags %s",
  843. MAJOR(__entry->dev), MINOR(__entry->dev),
  844. __entry->ino,
  845. __entry->size,
  846. __entry->new_size,
  847. __entry->offset,
  848. __entry->count,
  849. __print_flags(__entry->flags, "|", XFS_IO_FLAGS))
  850. )
  851. #define DEFINE_RW_EVENT(name) \
  852. DEFINE_EVENT(xfs_file_class, name, \
  853. TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags), \
  854. TP_ARGS(ip, count, offset, flags))
  855. DEFINE_RW_EVENT(xfs_file_read);
  856. DEFINE_RW_EVENT(xfs_file_buffered_write);
  857. DEFINE_RW_EVENT(xfs_file_direct_write);
  858. DEFINE_RW_EVENT(xfs_file_splice_read);
  859. DEFINE_RW_EVENT(xfs_file_splice_write);
  860. DECLARE_EVENT_CLASS(xfs_page_class,
  861. TP_PROTO(struct inode *inode, struct page *page, unsigned long off),
  862. TP_ARGS(inode, page, off),
  863. TP_STRUCT__entry(
  864. __field(dev_t, dev)
  865. __field(xfs_ino_t, ino)
  866. __field(pgoff_t, pgoff)
  867. __field(loff_t, size)
  868. __field(unsigned long, offset)
  869. __field(int, delalloc)
  870. __field(int, unwritten)
  871. ),
  872. TP_fast_assign(
  873. int delalloc = -1, unwritten = -1;
  874. if (page_has_buffers(page))
  875. xfs_count_page_state(page, &delalloc, &unwritten);
  876. __entry->dev = inode->i_sb->s_dev;
  877. __entry->ino = XFS_I(inode)->i_ino;
  878. __entry->pgoff = page_offset(page);
  879. __entry->size = i_size_read(inode);
  880. __entry->offset = off;
  881. __entry->delalloc = delalloc;
  882. __entry->unwritten = unwritten;
  883. ),
  884. TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx "
  885. "delalloc %d unwritten %d",
  886. MAJOR(__entry->dev), MINOR(__entry->dev),
  887. __entry->ino,
  888. __entry->pgoff,
  889. __entry->size,
  890. __entry->offset,
  891. __entry->delalloc,
  892. __entry->unwritten)
  893. )
  894. #define DEFINE_PAGE_EVENT(name) \
  895. DEFINE_EVENT(xfs_page_class, name, \
  896. TP_PROTO(struct inode *inode, struct page *page, unsigned long off), \
  897. TP_ARGS(inode, page, off))
  898. DEFINE_PAGE_EVENT(xfs_writepage);
  899. DEFINE_PAGE_EVENT(xfs_releasepage);
  900. DEFINE_PAGE_EVENT(xfs_invalidatepage);
  901. DECLARE_EVENT_CLASS(xfs_imap_class,
  902. TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
  903. int type, struct xfs_bmbt_irec *irec),
  904. TP_ARGS(ip, offset, count, type, irec),
  905. TP_STRUCT__entry(
  906. __field(dev_t, dev)
  907. __field(xfs_ino_t, ino)
  908. __field(loff_t, size)
  909. __field(loff_t, new_size)
  910. __field(loff_t, offset)
  911. __field(size_t, count)
  912. __field(int, type)
  913. __field(xfs_fileoff_t, startoff)
  914. __field(xfs_fsblock_t, startblock)
  915. __field(xfs_filblks_t, blockcount)
  916. ),
  917. TP_fast_assign(
  918. __entry->dev = VFS_I(ip)->i_sb->s_dev;
  919. __entry->ino = ip->i_ino;
  920. __entry->size = ip->i_d.di_size;
  921. __entry->new_size = ip->i_new_size;
  922. __entry->offset = offset;
  923. __entry->count = count;
  924. __entry->type = type;
  925. __entry->startoff = irec ? irec->br_startoff : 0;
  926. __entry->startblock = irec ? irec->br_startblock : 0;
  927. __entry->blockcount = irec ? irec->br_blockcount : 0;
  928. ),
  929. TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx "
  930. "offset 0x%llx count %zd type %s "
  931. "startoff 0x%llx startblock %lld blockcount 0x%llx",
  932. MAJOR(__entry->dev), MINOR(__entry->dev),
  933. __entry->ino,
  934. __entry->size,
  935. __entry->new_size,
  936. __entry->offset,
  937. __entry->count,
  938. __print_symbolic(__entry->type, XFS_IO_TYPES),
  939. __entry->startoff,
  940. (__int64_t)__entry->startblock,
  941. __entry->blockcount)
  942. )
  943. #define DEFINE_IOMAP_EVENT(name) \
  944. DEFINE_EVENT(xfs_imap_class, name, \
  945. TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
  946. int type, struct xfs_bmbt_irec *irec), \
  947. TP_ARGS(ip, offset, count, type, irec))
  948. DEFINE_IOMAP_EVENT(xfs_map_blocks_found);
  949. DEFINE_IOMAP_EVENT(xfs_map_blocks_alloc);
  950. DEFINE_IOMAP_EVENT(xfs_get_blocks_found);
  951. DEFINE_IOMAP_EVENT(xfs_get_blocks_alloc);
  952. DECLARE_EVENT_CLASS(xfs_simple_io_class,
  953. TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
  954. TP_ARGS(ip, offset, count),
  955. TP_STRUCT__entry(
  956. __field(dev_t, dev)
  957. __field(xfs_ino_t, ino)
  958. __field(loff_t, size)
  959. __field(loff_t, new_size)
  960. __field(loff_t, offset)
  961. __field(size_t, count)
  962. ),
  963. TP_fast_assign(
  964. __entry->dev = VFS_I(ip)->i_sb->s_dev;
  965. __entry->ino = ip->i_ino;
  966. __entry->size = ip->i_d.di_size;
  967. __entry->new_size = ip->i_new_size;
  968. __entry->offset = offset;
  969. __entry->count = count;
  970. ),
  971. TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx "
  972. "offset 0x%llx count %zd",
  973. MAJOR(__entry->dev), MINOR(__entry->dev),
  974. __entry->ino,
  975. __entry->size,
  976. __entry->new_size,
  977. __entry->offset,
  978. __entry->count)
  979. );
  980. #define DEFINE_SIMPLE_IO_EVENT(name) \
  981. DEFINE_EVENT(xfs_simple_io_class, name, \
  982. TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \
  983. TP_ARGS(ip, offset, count))
  984. DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
  985. DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
  986. DEFINE_SIMPLE_IO_EVENT(xfs_get_blocks_notfound);
  987. TRACE_EVENT(xfs_itruncate_start,
  988. TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size, int flag,
  989. xfs_off_t toss_start, xfs_off_t toss_finish),
  990. TP_ARGS(ip, new_size, flag, toss_start, toss_finish),
  991. TP_STRUCT__entry(
  992. __field(dev_t, dev)
  993. __field(xfs_ino_t, ino)
  994. __field(xfs_fsize_t, size)
  995. __field(xfs_fsize_t, new_size)
  996. __field(xfs_off_t, toss_start)
  997. __field(xfs_off_t, toss_finish)
  998. __field(int, flag)
  999. ),
  1000. TP_fast_assign(
  1001. __entry->dev = VFS_I(ip)->i_sb->s_dev;
  1002. __entry->ino = ip->i_ino;
  1003. __entry->size = ip->i_d.di_size;
  1004. __entry->new_size = new_size;
  1005. __entry->toss_start = toss_start;
  1006. __entry->toss_finish = toss_finish;
  1007. __entry->flag = flag;
  1008. ),
  1009. TP_printk("dev %d:%d ino 0x%llx %s size 0x%llx new_size 0x%llx "
  1010. "toss start 0x%llx toss finish 0x%llx",
  1011. MAJOR(__entry->dev), MINOR(__entry->dev),
  1012. __entry->ino,
  1013. __print_flags(__entry->flag, "|", XFS_ITRUNC_FLAGS),
  1014. __entry->size,
  1015. __entry->new_size,
  1016. __entry->toss_start,
  1017. __entry->toss_finish)
  1018. );
  1019. DECLARE_EVENT_CLASS(xfs_itrunc_class,
  1020. TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
  1021. TP_ARGS(ip, new_size),
  1022. TP_STRUCT__entry(
  1023. __field(dev_t, dev)
  1024. __field(xfs_ino_t, ino)
  1025. __field(xfs_fsize_t, size)
  1026. __field(xfs_fsize_t, new_size)
  1027. ),
  1028. TP_fast_assign(
  1029. __entry->dev = VFS_I(ip)->i_sb->s_dev;
  1030. __entry->ino = ip->i_ino;
  1031. __entry->size = ip->i_d.di_size;
  1032. __entry->new_size = new_size;
  1033. ),
  1034. TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
  1035. MAJOR(__entry->dev), MINOR(__entry->dev),
  1036. __entry->ino,
  1037. __entry->size,
  1038. __entry->new_size)
  1039. )
  1040. #define DEFINE_ITRUNC_EVENT(name) \
  1041. DEFINE_EVENT(xfs_itrunc_class, name, \
  1042. TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
  1043. TP_ARGS(ip, new_size))
  1044. DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_start);
  1045. DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_end);
  1046. TRACE_EVENT(xfs_pagecache_inval,
  1047. TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
  1048. TP_ARGS(ip, start, finish),
  1049. TP_STRUCT__entry(
  1050. __field(dev_t, dev)
  1051. __field(xfs_ino_t, ino)
  1052. __field(xfs_fsize_t, size)
  1053. __field(xfs_off_t, start)
  1054. __field(xfs_off_t, finish)
  1055. ),
  1056. TP_fast_assign(
  1057. __entry->dev = VFS_I(ip)->i_sb->s_dev;
  1058. __entry->ino = ip->i_ino;
  1059. __entry->size = ip->i_d.di_size;
  1060. __entry->start = start;
  1061. __entry->finish = finish;
  1062. ),
  1063. TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
  1064. MAJOR(__entry->dev), MINOR(__entry->dev),
  1065. __entry->ino,
  1066. __entry->size,
  1067. __entry->start,
  1068. __entry->finish)
  1069. );
  1070. TRACE_EVENT(xfs_bunmap,
  1071. TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
  1072. int flags, unsigned long caller_ip),
  1073. TP_ARGS(ip, bno, len, flags, caller_ip),
  1074. TP_STRUCT__entry(
  1075. __field(dev_t, dev)
  1076. __field(xfs_ino_t, ino)
  1077. __field(xfs_fsize_t, size)
  1078. __field(xfs_fileoff_t, bno)
  1079. __field(xfs_filblks_t, len)
  1080. __field(unsigned long, caller_ip)
  1081. __field(int, flags)
  1082. ),
  1083. TP_fast_assign(
  1084. __entry->dev = VFS_I(ip)->i_sb->s_dev;
  1085. __entry->ino = ip->i_ino;
  1086. __entry->size = ip->i_d.di_size;
  1087. __entry->bno = bno;
  1088. __entry->len = len;
  1089. __entry->caller_ip = caller_ip;
  1090. __entry->flags = flags;
  1091. ),
  1092. TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx"
  1093. "flags %s caller %pf",
  1094. MAJOR(__entry->dev), MINOR(__entry->dev),
  1095. __entry->ino,
  1096. __entry->size,
  1097. __entry->bno,
  1098. __entry->len,
  1099. __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
  1100. (void *)__entry->caller_ip)
  1101. );
  1102. DECLARE_EVENT_CLASS(xfs_busy_class,
  1103. TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
  1104. xfs_agblock_t agbno, xfs_extlen_t len),
  1105. TP_ARGS(mp, agno, agbno, len),
  1106. TP_STRUCT__entry(
  1107. __field(dev_t, dev)
  1108. __field(xfs_agnumber_t, agno)
  1109. __field(xfs_agblock_t, agbno)
  1110. __field(xfs_extlen_t, len)
  1111. ),
  1112. TP_fast_assign(
  1113. __entry->dev = mp->m_super->s_dev;
  1114. __entry->agno = agno;
  1115. __entry->agbno = agbno;
  1116. __entry->len = len;
  1117. ),
  1118. TP_printk("dev %d:%d agno %u agbno %u len %u",
  1119. MAJOR(__entry->dev), MINOR(__entry->dev),
  1120. __entry->agno,
  1121. __entry->agbno,
  1122. __entry->len)
  1123. );
  1124. #define DEFINE_BUSY_EVENT(name) \
  1125. DEFINE_EVENT(xfs_busy_class, name, \
  1126. TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
  1127. xfs_agblock_t agbno, xfs_extlen_t len), \
  1128. TP_ARGS(mp, agno, agbno, len))
  1129. DEFINE_BUSY_EVENT(xfs_alloc_busy);
  1130. DEFINE_BUSY_EVENT(xfs_alloc_busy_enomem);
  1131. DEFINE_BUSY_EVENT(xfs_alloc_busy_force);
  1132. DEFINE_BUSY_EVENT(xfs_alloc_busy_reuse);
  1133. DEFINE_BUSY_EVENT(xfs_alloc_busy_clear);
  1134. TRACE_EVENT(xfs_alloc_busy_trim,
  1135. TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
  1136. xfs_agblock_t agbno, xfs_extlen_t len,
  1137. xfs_agblock_t tbno, xfs_extlen_t tlen),
  1138. TP_ARGS(mp, agno, agbno, len, tbno, tlen),
  1139. TP_STRUCT__entry(
  1140. __field(dev_t, dev)
  1141. __field(xfs_agnumber_t, agno)
  1142. __field(xfs_agblock_t, agbno)
  1143. __field(xfs_extlen_t, len)
  1144. __field(xfs_agblock_t, tbno)
  1145. __field(xfs_extlen_t, tlen)
  1146. ),
  1147. TP_fast_assign(
  1148. __entry->dev = mp->m_super->s_dev;
  1149. __entry->agno = agno;
  1150. __entry->agbno = agbno;
  1151. __entry->len = len;
  1152. __entry->tbno = tbno;
  1153. __entry->tlen = tlen;
  1154. ),
  1155. TP_printk("dev %d:%d agno %u agbno %u len %u tbno %u tlen %u",
  1156. MAJOR(__entry->dev), MINOR(__entry->dev),
  1157. __entry->agno,
  1158. __entry->agbno,
  1159. __entry->len,
  1160. __entry->tbno,
  1161. __entry->tlen)
  1162. );
  1163. TRACE_EVENT(xfs_trans_commit_lsn,
  1164. TP_PROTO(struct xfs_trans *trans),
  1165. TP_ARGS(trans),
  1166. TP_STRUCT__entry(
  1167. __field(dev_t, dev)
  1168. __field(struct xfs_trans *, tp)
  1169. __field(xfs_lsn_t, lsn)
  1170. ),
  1171. TP_fast_assign(
  1172. __entry->dev = trans->t_mountp->m_super->s_dev;
  1173. __entry->tp = trans;
  1174. __entry->lsn = trans->t_commit_lsn;
  1175. ),
  1176. TP_printk("dev %d:%d trans 0x%p commit_lsn 0x%llx",
  1177. MAJOR(__entry->dev), MINOR(__entry->dev),
  1178. __entry->tp,
  1179. __entry->lsn)
  1180. );
  1181. TRACE_EVENT(xfs_agf,
  1182. TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
  1183. unsigned long caller_ip),
  1184. TP_ARGS(mp, agf, flags, caller_ip),
  1185. TP_STRUCT__entry(
  1186. __field(dev_t, dev)
  1187. __field(xfs_agnumber_t, agno)
  1188. __field(int, flags)
  1189. __field(__u32, length)
  1190. __field(__u32, bno_root)
  1191. __field(__u32, cnt_root)
  1192. __field(__u32, bno_level)
  1193. __field(__u32, cnt_level)
  1194. __field(__u32, flfirst)
  1195. __field(__u32, fllast)
  1196. __field(__u32, flcount)
  1197. __field(__u32, freeblks)
  1198. __field(__u32, longest)
  1199. __field(unsigned long, caller_ip)
  1200. ),
  1201. TP_fast_assign(
  1202. __entry->dev = mp->m_super->s_dev;
  1203. __entry->agno = be32_to_cpu(agf->agf_seqno),
  1204. __entry->flags = flags;
  1205. __entry->length = be32_to_cpu(agf->agf_length),
  1206. __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
  1207. __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
  1208. __entry->bno_level =
  1209. be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
  1210. __entry->cnt_level =
  1211. be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
  1212. __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
  1213. __entry->fllast = be32_to_cpu(agf->agf_fllast),
  1214. __entry->flcount = be32_to_cpu(agf->agf_flcount),
  1215. __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
  1216. __entry->longest = be32_to_cpu(agf->agf_longest);
  1217. __entry->caller_ip = caller_ip;
  1218. ),
  1219. TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
  1220. "levels b %u c %u flfirst %u fllast %u flcount %u "
  1221. "freeblks %u longest %u caller %pf",
  1222. MAJOR(__entry->dev), MINOR(__entry->dev),
  1223. __entry->agno,
  1224. __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
  1225. __entry->length,
  1226. __entry->bno_root,
  1227. __entry->cnt_root,
  1228. __entry->bno_level,
  1229. __entry->cnt_level,
  1230. __entry->flfirst,
  1231. __entry->fllast,
  1232. __entry->flcount,
  1233. __entry->freeblks,
  1234. __entry->longest,
  1235. (void *)__entry->caller_ip)
  1236. );
  1237. TRACE_EVENT(xfs_free_extent,
  1238. TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
  1239. xfs_extlen_t len, bool isfl, int haveleft, int haveright),
  1240. TP_ARGS(mp, agno, agbno, len, isfl, haveleft, haveright),
  1241. TP_STRUCT__entry(
  1242. __field(dev_t, dev)
  1243. __field(xfs_agnumber_t, agno)
  1244. __field(xfs_agblock_t, agbno)
  1245. __field(xfs_extlen_t, len)
  1246. __field(int, isfl)
  1247. __field(int, haveleft)
  1248. __field(int, haveright)
  1249. ),
  1250. TP_fast_assign(
  1251. __entry->dev = mp->m_super->s_dev;
  1252. __entry->agno = agno;
  1253. __entry->agbno = agbno;
  1254. __entry->len = len;
  1255. __entry->isfl = isfl;
  1256. __entry->haveleft = haveleft;
  1257. __entry->haveright = haveright;
  1258. ),
  1259. TP_printk("dev %d:%d agno %u agbno %u len %u isfl %d %s",
  1260. MAJOR(__entry->dev), MINOR(__entry->dev),
  1261. __entry->agno,
  1262. __entry->agbno,
  1263. __entry->len,
  1264. __entry->isfl,
  1265. __entry->haveleft ?
  1266. (__entry->haveright ? "both" : "left") :
  1267. (__entry->haveright ? "right" : "none"))
  1268. );
  1269. DECLARE_EVENT_CLASS(xfs_alloc_class,
  1270. TP_PROTO(struct xfs_alloc_arg *args),
  1271. TP_ARGS(args),
  1272. TP_STRUCT__entry(
  1273. __field(dev_t, dev)
  1274. __field(xfs_agnumber_t, agno)
  1275. __field(xfs_agblock_t, agbno)
  1276. __field(xfs_extlen_t, minlen)
  1277. __field(xfs_extlen_t, maxlen)
  1278. __field(xfs_extlen_t, mod)
  1279. __field(xfs_extlen_t, prod)
  1280. __field(xfs_extlen_t, minleft)
  1281. __field(xfs_extlen_t, total)
  1282. __field(xfs_extlen_t, alignment)
  1283. __field(xfs_extlen_t, minalignslop)
  1284. __field(xfs_extlen_t, len)
  1285. __field(short, type)
  1286. __field(short, otype)
  1287. __field(char, wasdel)
  1288. __field(char, wasfromfl)
  1289. __field(char, isfl)
  1290. __field(char, userdata)
  1291. __field(xfs_fsblock_t, firstblock)
  1292. ),
  1293. TP_fast_assign(
  1294. __entry->dev = args->mp->m_super->s_dev;
  1295. __entry->agno = args->agno;
  1296. __entry->agbno = args->agbno;
  1297. __entry->minlen = args->minlen;
  1298. __entry->maxlen = args->maxlen;
  1299. __entry->mod = args->mod;
  1300. __entry->prod = args->prod;
  1301. __entry->minleft = args->minleft;
  1302. __entry->total = args->total;
  1303. __entry->alignment = args->alignment;
  1304. __entry->minalignslop = args->minalignslop;
  1305. __entry->len = args->len;
  1306. __entry->type = args->type;
  1307. __entry->otype = args->otype;
  1308. __entry->wasdel = args->wasdel;
  1309. __entry->wasfromfl = args->wasfromfl;
  1310. __entry->isfl = args->isfl;
  1311. __entry->userdata = args->userdata;
  1312. __entry->firstblock = args->firstblock;
  1313. ),
  1314. TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
  1315. "prod %u minleft %u total %u alignment %u minalignslop %u "
  1316. "len %u type %s otype %s wasdel %d wasfromfl %d isfl %d "
  1317. "userdata %d firstblock 0x%llx",
  1318. MAJOR(__entry->dev), MINOR(__entry->dev),
  1319. __entry->agno,
  1320. __entry->agbno,
  1321. __entry->minlen,
  1322. __entry->maxlen,
  1323. __entry->mod,
  1324. __entry->prod,
  1325. __entry->minleft,
  1326. __entry->total,
  1327. __entry->alignment,
  1328. __entry->minalignslop,
  1329. __entry->len,
  1330. __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
  1331. __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
  1332. __entry->wasdel,
  1333. __entry->wasfromfl,
  1334. __entry->isfl,
  1335. __entry->userdata,
  1336. (unsigned long long)__entry->firstblock)
  1337. )
  1338. #define DEFINE_ALLOC_EVENT(name) \
  1339. DEFINE_EVENT(xfs_alloc_class, name, \
  1340. TP_PROTO(struct xfs_alloc_arg *args), \
  1341. TP_ARGS(args))
  1342. DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
  1343. DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
  1344. DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
  1345. DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
  1346. DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
  1347. DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
  1348. DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
  1349. DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
  1350. DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
  1351. DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
  1352. DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
  1353. DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
  1354. DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
  1355. DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
  1356. DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
  1357. DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
  1358. DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
  1359. DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
  1360. DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
  1361. DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
  1362. DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
  1363. DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
  1364. DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
  1365. DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
  1366. DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
  1367. DECLARE_EVENT_CLASS(xfs_dir2_class,
  1368. TP_PROTO(struct xfs_da_args *args),
  1369. TP_ARGS(args),
  1370. TP_STRUCT__entry(
  1371. __field(dev_t, dev)
  1372. __field(xfs_ino_t, ino)
  1373. __dynamic_array(char, name, args->namelen)
  1374. __field(int, namelen)
  1375. __field(xfs_dahash_t, hashval)
  1376. __field(xfs_ino_t, inumber)
  1377. __field(int, op_flags)
  1378. ),
  1379. TP_fast_assign(
  1380. __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
  1381. __entry->ino = args->dp->i_ino;
  1382. if (args->namelen)
  1383. memcpy(__get_str(name), args->name, args->namelen);
  1384. __entry->namelen = args->namelen;
  1385. __entry->hashval = args->hashval;
  1386. __entry->inumber = args->inumber;
  1387. __entry->op_flags = args->op_flags;
  1388. ),
  1389. TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
  1390. "inumber 0x%llx op_flags %s",
  1391. MAJOR(__entry->dev), MINOR(__entry->dev),
  1392. __entry->ino,
  1393. __entry->namelen,
  1394. __entry->namelen ? __get_str(name) : NULL,
  1395. __entry->namelen,
  1396. __entry->hashval,
  1397. __entry->inumber,
  1398. __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
  1399. )
  1400. #define DEFINE_DIR2_EVENT(name) \
  1401. DEFINE_EVENT(xfs_dir2_class, name, \
  1402. TP_PROTO(struct xfs_da_args *args), \
  1403. TP_ARGS(args))
  1404. DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
  1405. DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
  1406. DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
  1407. DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
  1408. DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
  1409. DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
  1410. DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
  1411. DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
  1412. DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
  1413. DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
  1414. DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
  1415. DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
  1416. DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
  1417. DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
  1418. DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
  1419. DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
  1420. DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
  1421. DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
  1422. DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
  1423. DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
  1424. DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
  1425. DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
  1426. DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
  1427. DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
  1428. DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
  1429. DECLARE_EVENT_CLASS(xfs_dir2_space_class,
  1430. TP_PROTO(struct xfs_da_args *args, int idx),
  1431. TP_ARGS(args, idx),
  1432. TP_STRUCT__entry(
  1433. __field(dev_t, dev)
  1434. __field(xfs_ino_t, ino)
  1435. __field(int, op_flags)
  1436. __field(int, idx)
  1437. ),
  1438. TP_fast_assign(
  1439. __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
  1440. __entry->ino = args->dp->i_ino;
  1441. __entry->op_flags = args->op_flags;
  1442. __entry->idx = idx;
  1443. ),
  1444. TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
  1445. MAJOR(__entry->dev), MINOR(__entry->dev),
  1446. __entry->ino,
  1447. __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
  1448. __entry->idx)
  1449. )
  1450. #define DEFINE_DIR2_SPACE_EVENT(name) \
  1451. DEFINE_EVENT(xfs_dir2_space_class, name, \
  1452. TP_PROTO(struct xfs_da_args *args, int idx), \
  1453. TP_ARGS(args, idx))
  1454. DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
  1455. DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
  1456. DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
  1457. DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
  1458. TRACE_EVENT(xfs_dir2_leafn_moveents,
  1459. TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
  1460. TP_ARGS(args, src_idx, dst_idx, count),
  1461. TP_STRUCT__entry(
  1462. __field(dev_t, dev)
  1463. __field(xfs_ino_t, ino)
  1464. __field(int, op_flags)
  1465. __field(int, src_idx)
  1466. __field(int, dst_idx)
  1467. __field(int, count)
  1468. ),
  1469. TP_fast_assign(
  1470. __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
  1471. __entry->ino = args->dp->i_ino;
  1472. __entry->op_flags = args->op_flags;
  1473. __entry->src_idx = src_idx;
  1474. __entry->dst_idx = dst_idx;
  1475. __entry->count = count;
  1476. ),
  1477. TP_printk("dev %d:%d ino 0x%llx op_flags %s "
  1478. "src_idx %d dst_idx %d count %d",
  1479. MAJOR(__entry->dev), MINOR(__entry->dev),
  1480. __entry->ino,
  1481. __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
  1482. __entry->src_idx,
  1483. __entry->dst_idx,
  1484. __entry->count)
  1485. );
  1486. #define XFS_SWAPEXT_INODES \
  1487. { 0, "target" }, \
  1488. { 1, "temp" }
  1489. #define XFS_INODE_FORMAT_STR \
  1490. { 0, "invalid" }, \
  1491. { 1, "local" }, \
  1492. { 2, "extent" }, \
  1493. { 3, "btree" }
  1494. DECLARE_EVENT_CLASS(xfs_swap_extent_class,
  1495. TP_PROTO(struct xfs_inode *ip, int which),
  1496. TP_ARGS(ip, which),
  1497. TP_STRUCT__entry(
  1498. __field(dev_t, dev)
  1499. __field(int, which)
  1500. __field(xfs_ino_t, ino)
  1501. __field(int, format)
  1502. __field(int, nex)
  1503. __field(int, max_nex)
  1504. __field(int, broot_size)
  1505. __field(int, fork_off)
  1506. ),
  1507. TP_fast_assign(
  1508. __entry->dev = VFS_I(ip)->i_sb->s_dev;
  1509. __entry->which = which;
  1510. __entry->ino = ip->i_ino;
  1511. __entry->format = ip->i_d.di_format;
  1512. __entry->nex = ip->i_d.di_nextents;
  1513. __entry->max_nex = ip->i_df.if_ext_max;
  1514. __entry->broot_size = ip->i_df.if_broot_bytes;
  1515. __entry->fork_off = XFS_IFORK_BOFF(ip);
  1516. ),
  1517. TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
  1518. "Max in-fork extents %d, broot size %d, fork offset %d",
  1519. MAJOR(__entry->dev), MINOR(__entry->dev),
  1520. __entry->ino,
  1521. __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
  1522. __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
  1523. __entry->nex,
  1524. __entry->max_nex,
  1525. __entry->broot_size,
  1526. __entry->fork_off)
  1527. )
  1528. #define DEFINE_SWAPEXT_EVENT(name) \
  1529. DEFINE_EVENT(xfs_swap_extent_class, name, \
  1530. TP_PROTO(struct xfs_inode *ip, int which), \
  1531. TP_ARGS(ip, which))
  1532. DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
  1533. DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
  1534. DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
  1535. TP_PROTO(struct log *log, struct xlog_recover *trans,
  1536. struct xlog_recover_item *item, int pass),
  1537. TP_ARGS(log, trans, item, pass),
  1538. TP_STRUCT__entry(
  1539. __field(dev_t, dev)
  1540. __field(unsigned long, item)
  1541. __field(xlog_tid_t, tid)
  1542. __field(int, type)
  1543. __field(int, pass)
  1544. __field(int, count)
  1545. __field(int, total)
  1546. ),
  1547. TP_fast_assign(
  1548. __entry->dev = log->l_mp->m_super->s_dev;
  1549. __entry->item = (unsigned long)item;
  1550. __entry->tid = trans->r_log_tid;
  1551. __entry->type = ITEM_TYPE(item);
  1552. __entry->pass = pass;
  1553. __entry->count = item->ri_cnt;
  1554. __entry->total = item->ri_total;
  1555. ),
  1556. TP_printk("dev %d:%d trans 0x%x, pass %d, item 0x%p, item type %s "
  1557. "item region count/total %d/%d",
  1558. MAJOR(__entry->dev), MINOR(__entry->dev),
  1559. __entry->tid,
  1560. __entry->pass,
  1561. (void *)__entry->item,
  1562. __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
  1563. __entry->count,
  1564. __entry->total)
  1565. )
  1566. #define DEFINE_LOG_RECOVER_ITEM(name) \
  1567. DEFINE_EVENT(xfs_log_recover_item_class, name, \
  1568. TP_PROTO(struct log *log, struct xlog_recover *trans, \
  1569. struct xlog_recover_item *item, int pass), \
  1570. TP_ARGS(log, trans, item, pass))
  1571. DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
  1572. DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
  1573. DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
  1574. DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
  1575. DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
  1576. DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
  1577. TP_PROTO(struct log *log, struct xfs_buf_log_format *buf_f),
  1578. TP_ARGS(log, buf_f),
  1579. TP_STRUCT__entry(
  1580. __field(dev_t, dev)
  1581. __field(__int64_t, blkno)
  1582. __field(unsigned short, len)
  1583. __field(unsigned short, flags)
  1584. __field(unsigned short, size)
  1585. __field(unsigned int, map_size)
  1586. ),
  1587. TP_fast_assign(
  1588. __entry->dev = log->l_mp->m_super->s_dev;
  1589. __entry->blkno = buf_f->blf_blkno;
  1590. __entry->len = buf_f->blf_len;
  1591. __entry->flags = buf_f->blf_flags;
  1592. __entry->size = buf_f->blf_size;
  1593. __entry->map_size = buf_f->blf_map_size;
  1594. ),
  1595. TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
  1596. "map_size %d",
  1597. MAJOR(__entry->dev), MINOR(__entry->dev),
  1598. __entry->blkno,
  1599. __entry->len,
  1600. __entry->flags,
  1601. __entry->size,
  1602. __entry->map_size)
  1603. )
  1604. #define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
  1605. DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
  1606. TP_PROTO(struct log *log, struct xfs_buf_log_format *buf_f), \
  1607. TP_ARGS(log, buf_f))
  1608. DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
  1609. DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
  1610. DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
  1611. DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
  1612. DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
  1613. DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
  1614. DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
  1615. DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
  1616. DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
  1617. TP_PROTO(struct log *log, struct xfs_inode_log_format *in_f),
  1618. TP_ARGS(log, in_f),
  1619. TP_STRUCT__entry(
  1620. __field(dev_t, dev)
  1621. __field(xfs_ino_t, ino)
  1622. __field(unsigned short, size)
  1623. __field(int, fields)
  1624. __field(unsigned short, asize)
  1625. __field(unsigned short, dsize)
  1626. __field(__int64_t, blkno)
  1627. __field(int, len)
  1628. __field(int, boffset)
  1629. ),
  1630. TP_fast_assign(
  1631. __entry->dev = log->l_mp->m_super->s_dev;
  1632. __entry->ino = in_f->ilf_ino;
  1633. __entry->size = in_f->ilf_size;
  1634. __entry->fields = in_f->ilf_fields;
  1635. __entry->asize = in_f->ilf_asize;
  1636. __entry->dsize = in_f->ilf_dsize;
  1637. __entry->blkno = in_f->ilf_blkno;
  1638. __entry->len = in_f->ilf_len;
  1639. __entry->boffset = in_f->ilf_boffset;
  1640. ),
  1641. TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
  1642. "dsize %d, blkno 0x%llx, len %d, boffset %d",
  1643. MAJOR(__entry->dev), MINOR(__entry->dev),
  1644. __entry->ino,
  1645. __entry->size,
  1646. __entry->fields,
  1647. __entry->asize,
  1648. __entry->dsize,
  1649. __entry->blkno,
  1650. __entry->len,
  1651. __entry->boffset)
  1652. )
  1653. #define DEFINE_LOG_RECOVER_INO_ITEM(name) \
  1654. DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
  1655. TP_PROTO(struct log *log, struct xfs_inode_log_format *in_f), \
  1656. TP_ARGS(log, in_f))
  1657. DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
  1658. DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
  1659. DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
  1660. DECLARE_EVENT_CLASS(xfs_discard_class,
  1661. TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
  1662. xfs_agblock_t agbno, xfs_extlen_t len),
  1663. TP_ARGS(mp, agno, agbno, len),
  1664. TP_STRUCT__entry(
  1665. __field(dev_t, dev)
  1666. __field(xfs_agnumber_t, agno)
  1667. __field(xfs_agblock_t, agbno)
  1668. __field(xfs_extlen_t, len)
  1669. ),
  1670. TP_fast_assign(
  1671. __entry->dev = mp->m_super->s_dev;
  1672. __entry->agno = agno;
  1673. __entry->agbno = agbno;
  1674. __entry->len = len;
  1675. ),
  1676. TP_printk("dev %d:%d agno %u agbno %u len %u\n",
  1677. MAJOR(__entry->dev), MINOR(__entry->dev),
  1678. __entry->agno,
  1679. __entry->agbno,
  1680. __entry->len)
  1681. )
  1682. #define DEFINE_DISCARD_EVENT(name) \
  1683. DEFINE_EVENT(xfs_discard_class, name, \
  1684. TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
  1685. xfs_agblock_t agbno, xfs_extlen_t len), \
  1686. TP_ARGS(mp, agno, agbno, len))
  1687. DEFINE_DISCARD_EVENT(xfs_discard_extent);
  1688. DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
  1689. DEFINE_DISCARD_EVENT(xfs_discard_exclude);
  1690. DEFINE_DISCARD_EVENT(xfs_discard_busy);
  1691. #endif /* _TRACE_XFS_H */
  1692. #undef TRACE_INCLUDE_PATH
  1693. #define TRACE_INCLUDE_PATH .
  1694. #define TRACE_INCLUDE_FILE xfs_trace
  1695. #include <trace/define_trace.h>