btrfs.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM btrfs
  3. #if !defined(_TRACE_BTRFS_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_BTRFS_H
  5. #include <linux/writeback.h>
  6. #include <linux/tracepoint.h>
  7. struct btrfs_root;
  8. struct btrfs_fs_info;
  9. struct btrfs_inode;
  10. struct extent_map;
  11. struct btrfs_ordered_extent;
  12. struct btrfs_delayed_ref_node;
  13. struct btrfs_delayed_tree_ref;
  14. struct btrfs_delayed_data_ref;
  15. struct btrfs_delayed_ref_head;
  16. struct map_lookup;
  17. struct extent_buffer;
  18. #define show_ref_type(type) \
  19. __print_symbolic(type, \
  20. { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \
  21. { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \
  22. { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \
  23. { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \
  24. { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" })
  25. #define __show_root_type(obj) \
  26. __print_symbolic_u64(obj, \
  27. { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \
  28. { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \
  29. { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \
  30. { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \
  31. { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \
  32. { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \
  33. { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \
  34. { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \
  35. { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \
  36. { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
  37. #define show_root_type(obj) \
  38. obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \
  39. (obj <= BTRFS_CSUM_TREE_OBJECTID )) ? __show_root_type(obj) : "-"
  40. TRACE_EVENT(btrfs_transaction_commit,
  41. TP_PROTO(struct btrfs_root *root),
  42. TP_ARGS(root),
  43. TP_STRUCT__entry(
  44. __field( u64, generation )
  45. __field( u64, root_objectid )
  46. ),
  47. TP_fast_assign(
  48. __entry->generation = root->fs_info->generation;
  49. __entry->root_objectid = root->root_key.objectid;
  50. ),
  51. TP_printk("root = %llu(%s), gen = %llu",
  52. show_root_type(__entry->root_objectid),
  53. (unsigned long long)__entry->generation)
  54. );
  55. DECLARE_EVENT_CLASS(btrfs__inode,
  56. TP_PROTO(struct inode *inode),
  57. TP_ARGS(inode),
  58. TP_STRUCT__entry(
  59. __field( ino_t, ino )
  60. __field( blkcnt_t, blocks )
  61. __field( u64, disk_i_size )
  62. __field( u64, generation )
  63. __field( u64, last_trans )
  64. __field( u64, logged_trans )
  65. __field( u64, root_objectid )
  66. ),
  67. TP_fast_assign(
  68. __entry->ino = inode->i_ino;
  69. __entry->blocks = inode->i_blocks;
  70. __entry->disk_i_size = BTRFS_I(inode)->disk_i_size;
  71. __entry->generation = BTRFS_I(inode)->generation;
  72. __entry->last_trans = BTRFS_I(inode)->last_trans;
  73. __entry->logged_trans = BTRFS_I(inode)->logged_trans;
  74. __entry->root_objectid =
  75. BTRFS_I(inode)->root->root_key.objectid;
  76. ),
  77. TP_printk("root = %llu(%s), gen = %llu, ino = %lu, blocks = %llu, "
  78. "disk_i_size = %llu, last_trans = %llu, logged_trans = %llu",
  79. show_root_type(__entry->root_objectid),
  80. (unsigned long long)__entry->generation,
  81. (unsigned long)__entry->ino,
  82. (unsigned long long)__entry->blocks,
  83. (unsigned long long)__entry->disk_i_size,
  84. (unsigned long long)__entry->last_trans,
  85. (unsigned long long)__entry->logged_trans)
  86. );
  87. DEFINE_EVENT(btrfs__inode, btrfs_inode_new,
  88. TP_PROTO(struct inode *inode),
  89. TP_ARGS(inode)
  90. );
  91. DEFINE_EVENT(btrfs__inode, btrfs_inode_request,
  92. TP_PROTO(struct inode *inode),
  93. TP_ARGS(inode)
  94. );
  95. DEFINE_EVENT(btrfs__inode, btrfs_inode_evict,
  96. TP_PROTO(struct inode *inode),
  97. TP_ARGS(inode)
  98. );
  99. #define __show_map_type(type) \
  100. __print_symbolic_u64(type, \
  101. { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \
  102. { EXTENT_MAP_HOLE, "HOLE" }, \
  103. { EXTENT_MAP_INLINE, "INLINE" }, \
  104. { EXTENT_MAP_DELALLOC, "DELALLOC" })
  105. #define show_map_type(type) \
  106. type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type)
  107. #define show_map_flags(flag) \
  108. __print_flags(flag, "|", \
  109. { EXTENT_FLAG_PINNED, "PINNED" }, \
  110. { EXTENT_FLAG_COMPRESSED, "COMPRESSED" }, \
  111. { EXTENT_FLAG_VACANCY, "VACANCY" }, \
  112. { EXTENT_FLAG_PREALLOC, "PREALLOC" })
  113. TRACE_EVENT(btrfs_get_extent,
  114. TP_PROTO(struct btrfs_root *root, struct extent_map *map),
  115. TP_ARGS(root, map),
  116. TP_STRUCT__entry(
  117. __field( u64, root_objectid )
  118. __field( u64, start )
  119. __field( u64, len )
  120. __field( u64, orig_start )
  121. __field( u64, block_start )
  122. __field( u64, block_len )
  123. __field( unsigned long, flags )
  124. __field( int, refs )
  125. __field( unsigned int, compress_type )
  126. ),
  127. TP_fast_assign(
  128. __entry->root_objectid = root->root_key.objectid;
  129. __entry->start = map->start;
  130. __entry->len = map->len;
  131. __entry->orig_start = map->orig_start;
  132. __entry->block_start = map->block_start;
  133. __entry->block_len = map->block_len;
  134. __entry->flags = map->flags;
  135. __entry->refs = atomic_read(&map->refs);
  136. __entry->compress_type = map->compress_type;
  137. ),
  138. TP_printk("root = %llu(%s), start = %llu, len = %llu, "
  139. "orig_start = %llu, block_start = %llu(%s), "
  140. "block_len = %llu, flags = %s, refs = %u, "
  141. "compress_type = %u",
  142. show_root_type(__entry->root_objectid),
  143. (unsigned long long)__entry->start,
  144. (unsigned long long)__entry->len,
  145. (unsigned long long)__entry->orig_start,
  146. show_map_type(__entry->block_start),
  147. (unsigned long long)__entry->block_len,
  148. show_map_flags(__entry->flags),
  149. __entry->refs, __entry->compress_type)
  150. );
  151. #define show_ordered_flags(flags) \
  152. __print_symbolic(flags, \
  153. { BTRFS_ORDERED_IO_DONE, "IO_DONE" }, \
  154. { BTRFS_ORDERED_COMPLETE, "COMPLETE" }, \
  155. { BTRFS_ORDERED_NOCOW, "NOCOW" }, \
  156. { BTRFS_ORDERED_COMPRESSED, "COMPRESSED" }, \
  157. { BTRFS_ORDERED_PREALLOC, "PREALLOC" }, \
  158. { BTRFS_ORDERED_DIRECT, "DIRECT" })
  159. DECLARE_EVENT_CLASS(btrfs__ordered_extent,
  160. TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
  161. TP_ARGS(inode, ordered),
  162. TP_STRUCT__entry(
  163. __field( ino_t, ino )
  164. __field( u64, file_offset )
  165. __field( u64, start )
  166. __field( u64, len )
  167. __field( u64, disk_len )
  168. __field( u64, bytes_left )
  169. __field( unsigned long, flags )
  170. __field( int, compress_type )
  171. __field( int, refs )
  172. __field( u64, root_objectid )
  173. ),
  174. TP_fast_assign(
  175. __entry->ino = inode->i_ino;
  176. __entry->file_offset = ordered->file_offset;
  177. __entry->start = ordered->start;
  178. __entry->len = ordered->len;
  179. __entry->disk_len = ordered->disk_len;
  180. __entry->bytes_left = ordered->bytes_left;
  181. __entry->flags = ordered->flags;
  182. __entry->compress_type = ordered->compress_type;
  183. __entry->refs = atomic_read(&ordered->refs);
  184. __entry->root_objectid =
  185. BTRFS_I(inode)->root->root_key.objectid;
  186. ),
  187. TP_printk("root = %llu(%s), ino = %llu, file_offset = %llu, "
  188. "start = %llu, len = %llu, disk_len = %llu, "
  189. "bytes_left = %llu, flags = %s, compress_type = %d, "
  190. "refs = %d",
  191. show_root_type(__entry->root_objectid),
  192. (unsigned long long)__entry->ino,
  193. (unsigned long long)__entry->file_offset,
  194. (unsigned long long)__entry->start,
  195. (unsigned long long)__entry->len,
  196. (unsigned long long)__entry->disk_len,
  197. (unsigned long long)__entry->bytes_left,
  198. show_ordered_flags(__entry->flags),
  199. __entry->compress_type, __entry->refs)
  200. );
  201. DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add,
  202. TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
  203. TP_ARGS(inode, ordered)
  204. );
  205. DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove,
  206. TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
  207. TP_ARGS(inode, ordered)
  208. );
  209. DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start,
  210. TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
  211. TP_ARGS(inode, ordered)
  212. );
  213. DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put,
  214. TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
  215. TP_ARGS(inode, ordered)
  216. );
  217. DECLARE_EVENT_CLASS(btrfs__writepage,
  218. TP_PROTO(struct page *page, struct inode *inode,
  219. struct writeback_control *wbc),
  220. TP_ARGS(page, inode, wbc),
  221. TP_STRUCT__entry(
  222. __field( ino_t, ino )
  223. __field( pgoff_t, index )
  224. __field( long, nr_to_write )
  225. __field( long, pages_skipped )
  226. __field( loff_t, range_start )
  227. __field( loff_t, range_end )
  228. __field( char, for_kupdate )
  229. __field( char, for_reclaim )
  230. __field( char, range_cyclic )
  231. __field( pgoff_t, writeback_index )
  232. __field( u64, root_objectid )
  233. ),
  234. TP_fast_assign(
  235. __entry->ino = inode->i_ino;
  236. __entry->index = page->index;
  237. __entry->nr_to_write = wbc->nr_to_write;
  238. __entry->pages_skipped = wbc->pages_skipped;
  239. __entry->range_start = wbc->range_start;
  240. __entry->range_end = wbc->range_end;
  241. __entry->for_kupdate = wbc->for_kupdate;
  242. __entry->for_reclaim = wbc->for_reclaim;
  243. __entry->range_cyclic = wbc->range_cyclic;
  244. __entry->writeback_index = inode->i_mapping->writeback_index;
  245. __entry->root_objectid =
  246. BTRFS_I(inode)->root->root_key.objectid;
  247. ),
  248. TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, "
  249. "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, "
  250. "range_end = %llu, for_kupdate = %d, "
  251. "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu",
  252. show_root_type(__entry->root_objectid),
  253. (unsigned long)__entry->ino, __entry->index,
  254. __entry->nr_to_write, __entry->pages_skipped,
  255. __entry->range_start, __entry->range_end,
  256. __entry->for_kupdate,
  257. __entry->for_reclaim, __entry->range_cyclic,
  258. (unsigned long)__entry->writeback_index)
  259. );
  260. DEFINE_EVENT(btrfs__writepage, __extent_writepage,
  261. TP_PROTO(struct page *page, struct inode *inode,
  262. struct writeback_control *wbc),
  263. TP_ARGS(page, inode, wbc)
  264. );
  265. TRACE_EVENT(btrfs_writepage_end_io_hook,
  266. TP_PROTO(struct page *page, u64 start, u64 end, int uptodate),
  267. TP_ARGS(page, start, end, uptodate),
  268. TP_STRUCT__entry(
  269. __field( ino_t, ino )
  270. __field( pgoff_t, index )
  271. __field( u64, start )
  272. __field( u64, end )
  273. __field( int, uptodate )
  274. __field( u64, root_objectid )
  275. ),
  276. TP_fast_assign(
  277. __entry->ino = page->mapping->host->i_ino;
  278. __entry->index = page->index;
  279. __entry->start = start;
  280. __entry->end = end;
  281. __entry->uptodate = uptodate;
  282. __entry->root_objectid =
  283. BTRFS_I(page->mapping->host)->root->root_key.objectid;
  284. ),
  285. TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, "
  286. "end = %llu, uptodate = %d",
  287. show_root_type(__entry->root_objectid),
  288. (unsigned long)__entry->ino, (unsigned long)__entry->index,
  289. (unsigned long long)__entry->start,
  290. (unsigned long long)__entry->end, __entry->uptodate)
  291. );
  292. TRACE_EVENT(btrfs_sync_file,
  293. TP_PROTO(struct file *file, int datasync),
  294. TP_ARGS(file, datasync),
  295. TP_STRUCT__entry(
  296. __field( ino_t, ino )
  297. __field( ino_t, parent )
  298. __field( int, datasync )
  299. __field( u64, root_objectid )
  300. ),
  301. TP_fast_assign(
  302. struct dentry *dentry = file->f_path.dentry;
  303. struct inode *inode = dentry->d_inode;
  304. __entry->ino = inode->i_ino;
  305. __entry->parent = dentry->d_parent->d_inode->i_ino;
  306. __entry->datasync = datasync;
  307. __entry->root_objectid =
  308. BTRFS_I(inode)->root->root_key.objectid;
  309. ),
  310. TP_printk("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d",
  311. show_root_type(__entry->root_objectid),
  312. (unsigned long)__entry->ino, (unsigned long)__entry->parent,
  313. __entry->datasync)
  314. );
  315. TRACE_EVENT(btrfs_sync_fs,
  316. TP_PROTO(int wait),
  317. TP_ARGS(wait),
  318. TP_STRUCT__entry(
  319. __field( int, wait )
  320. ),
  321. TP_fast_assign(
  322. __entry->wait = wait;
  323. ),
  324. TP_printk("wait = %d", __entry->wait)
  325. );
  326. #define show_ref_action(action) \
  327. __print_symbolic(action, \
  328. { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \
  329. { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \
  330. { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \
  331. { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" })
  332. TRACE_EVENT(btrfs_delayed_tree_ref,
  333. TP_PROTO(struct btrfs_delayed_ref_node *ref,
  334. struct btrfs_delayed_tree_ref *full_ref,
  335. int action),
  336. TP_ARGS(ref, full_ref, action),
  337. TP_STRUCT__entry(
  338. __field( u64, bytenr )
  339. __field( u64, num_bytes )
  340. __field( int, action )
  341. __field( u64, parent )
  342. __field( u64, ref_root )
  343. __field( int, level )
  344. __field( int, type )
  345. ),
  346. TP_fast_assign(
  347. __entry->bytenr = ref->bytenr;
  348. __entry->num_bytes = ref->num_bytes;
  349. __entry->action = action;
  350. __entry->parent = full_ref->parent;
  351. __entry->ref_root = full_ref->root;
  352. __entry->level = full_ref->level;
  353. __entry->type = ref->type;
  354. ),
  355. TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
  356. "parent = %llu(%s), ref_root = %llu(%s), level = %d, "
  357. "type = %s",
  358. (unsigned long long)__entry->bytenr,
  359. (unsigned long long)__entry->num_bytes,
  360. show_ref_action(__entry->action),
  361. show_root_type(__entry->parent),
  362. show_root_type(__entry->ref_root),
  363. __entry->level, show_ref_type(__entry->type))
  364. );
  365. TRACE_EVENT(btrfs_delayed_data_ref,
  366. TP_PROTO(struct btrfs_delayed_ref_node *ref,
  367. struct btrfs_delayed_data_ref *full_ref,
  368. int action),
  369. TP_ARGS(ref, full_ref, action),
  370. TP_STRUCT__entry(
  371. __field( u64, bytenr )
  372. __field( u64, num_bytes )
  373. __field( int, action )
  374. __field( u64, parent )
  375. __field( u64, ref_root )
  376. __field( u64, owner )
  377. __field( u64, offset )
  378. __field( int, type )
  379. ),
  380. TP_fast_assign(
  381. __entry->bytenr = ref->bytenr;
  382. __entry->num_bytes = ref->num_bytes;
  383. __entry->action = action;
  384. __entry->parent = full_ref->parent;
  385. __entry->ref_root = full_ref->root;
  386. __entry->owner = full_ref->objectid;
  387. __entry->offset = full_ref->offset;
  388. __entry->type = ref->type;
  389. ),
  390. TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
  391. "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, "
  392. "offset = %llu, type = %s",
  393. (unsigned long long)__entry->bytenr,
  394. (unsigned long long)__entry->num_bytes,
  395. show_ref_action(__entry->action),
  396. show_root_type(__entry->parent),
  397. show_root_type(__entry->ref_root),
  398. (unsigned long long)__entry->owner,
  399. (unsigned long long)__entry->offset,
  400. show_ref_type(__entry->type))
  401. );
  402. TRACE_EVENT(btrfs_delayed_ref_head,
  403. TP_PROTO(struct btrfs_delayed_ref_node *ref,
  404. struct btrfs_delayed_ref_head *head_ref,
  405. int action),
  406. TP_ARGS(ref, head_ref, action),
  407. TP_STRUCT__entry(
  408. __field( u64, bytenr )
  409. __field( u64, num_bytes )
  410. __field( int, action )
  411. __field( int, is_data )
  412. ),
  413. TP_fast_assign(
  414. __entry->bytenr = ref->bytenr;
  415. __entry->num_bytes = ref->num_bytes;
  416. __entry->action = action;
  417. __entry->is_data = head_ref->is_data;
  418. ),
  419. TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d",
  420. (unsigned long long)__entry->bytenr,
  421. (unsigned long long)__entry->num_bytes,
  422. show_ref_action(__entry->action),
  423. __entry->is_data)
  424. );
  425. #define show_chunk_type(type) \
  426. __print_flags(type, "|", \
  427. { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \
  428. { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
  429. { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
  430. { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \
  431. { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \
  432. { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \
  433. { BTRFS_BLOCK_GROUP_RAID10, "RAID10"})
  434. DECLARE_EVENT_CLASS(btrfs__chunk,
  435. TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
  436. u64 offset, u64 size),
  437. TP_ARGS(root, map, offset, size),
  438. TP_STRUCT__entry(
  439. __field( int, num_stripes )
  440. __field( u64, type )
  441. __field( int, sub_stripes )
  442. __field( u64, offset )
  443. __field( u64, size )
  444. __field( u64, root_objectid )
  445. ),
  446. TP_fast_assign(
  447. __entry->num_stripes = map->num_stripes;
  448. __entry->type = map->type;
  449. __entry->sub_stripes = map->sub_stripes;
  450. __entry->offset = offset;
  451. __entry->size = size;
  452. __entry->root_objectid = root->root_key.objectid;
  453. ),
  454. TP_printk("root = %llu(%s), offset = %llu, size = %llu, "
  455. "num_stripes = %d, sub_stripes = %d, type = %s",
  456. show_root_type(__entry->root_objectid),
  457. (unsigned long long)__entry->offset,
  458. (unsigned long long)__entry->size,
  459. __entry->num_stripes, __entry->sub_stripes,
  460. show_chunk_type(__entry->type))
  461. );
  462. DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc,
  463. TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
  464. u64 offset, u64 size),
  465. TP_ARGS(root, map, offset, size)
  466. );
  467. DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free,
  468. TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
  469. u64 offset, u64 size),
  470. TP_ARGS(root, map, offset, size)
  471. );
  472. TRACE_EVENT(btrfs_cow_block,
  473. TP_PROTO(struct btrfs_root *root, struct extent_buffer *buf,
  474. struct extent_buffer *cow),
  475. TP_ARGS(root, buf, cow),
  476. TP_STRUCT__entry(
  477. __field( u64, root_objectid )
  478. __field( u64, buf_start )
  479. __field( int, refs )
  480. __field( u64, cow_start )
  481. __field( int, buf_level )
  482. __field( int, cow_level )
  483. ),
  484. TP_fast_assign(
  485. __entry->root_objectid = root->root_key.objectid;
  486. __entry->buf_start = buf->start;
  487. __entry->refs = atomic_read(&buf->refs);
  488. __entry->cow_start = cow->start;
  489. __entry->buf_level = btrfs_header_level(buf);
  490. __entry->cow_level = btrfs_header_level(cow);
  491. ),
  492. TP_printk("root = %llu(%s), refs = %d, orig_buf = %llu "
  493. "(orig_level = %d), cow_buf = %llu (cow_level = %d)",
  494. show_root_type(__entry->root_objectid),
  495. __entry->refs,
  496. (unsigned long long)__entry->buf_start,
  497. __entry->buf_level,
  498. (unsigned long long)__entry->cow_start,
  499. __entry->cow_level)
  500. );
  501. DECLARE_EVENT_CLASS(btrfs__reserved_extent,
  502. TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
  503. TP_ARGS(root, start, len),
  504. TP_STRUCT__entry(
  505. __field( u64, root_objectid )
  506. __field( u64, start )
  507. __field( u64, len )
  508. ),
  509. TP_fast_assign(
  510. __entry->root_objectid = root->root_key.objectid;
  511. __entry->start = start;
  512. __entry->len = len;
  513. ),
  514. TP_printk("root = %llu(%s), start = %llu, len = %llu",
  515. show_root_type(__entry->root_objectid),
  516. (unsigned long long)__entry->start,
  517. (unsigned long long)__entry->len)
  518. );
  519. DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc,
  520. TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
  521. TP_ARGS(root, start, len)
  522. );
  523. DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free,
  524. TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
  525. TP_ARGS(root, start, len)
  526. );
  527. #endif /* _TRACE_BTRFS_H */
  528. /* This part must be outside protection */
  529. #include <trace/define_trace.h>