btrfs.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  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, nonblocking )
  229. __field( char, for_kupdate )
  230. __field( char, for_reclaim )
  231. __field( char, range_cyclic )
  232. __field( pgoff_t, writeback_index )
  233. __field( u64, root_objectid )
  234. ),
  235. TP_fast_assign(
  236. __entry->ino = inode->i_ino;
  237. __entry->index = page->index;
  238. __entry->nr_to_write = wbc->nr_to_write;
  239. __entry->pages_skipped = wbc->pages_skipped;
  240. __entry->range_start = wbc->range_start;
  241. __entry->range_end = wbc->range_end;
  242. __entry->nonblocking = wbc->nonblocking;
  243. __entry->for_kupdate = wbc->for_kupdate;
  244. __entry->for_reclaim = wbc->for_reclaim;
  245. __entry->range_cyclic = wbc->range_cyclic;
  246. __entry->writeback_index = inode->i_mapping->writeback_index;
  247. __entry->root_objectid =
  248. BTRFS_I(inode)->root->root_key.objectid;
  249. ),
  250. TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, "
  251. "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, "
  252. "range_end = %llu, nonblocking = %d, for_kupdate = %d, "
  253. "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu",
  254. show_root_type(__entry->root_objectid),
  255. (unsigned long)__entry->ino, __entry->index,
  256. __entry->nr_to_write, __entry->pages_skipped,
  257. __entry->range_start, __entry->range_end,
  258. __entry->nonblocking, __entry->for_kupdate,
  259. __entry->for_reclaim, __entry->range_cyclic,
  260. (unsigned long)__entry->writeback_index)
  261. );
  262. DEFINE_EVENT(btrfs__writepage, __extent_writepage,
  263. TP_PROTO(struct page *page, struct inode *inode,
  264. struct writeback_control *wbc),
  265. TP_ARGS(page, inode, wbc)
  266. );
  267. TRACE_EVENT(btrfs_writepage_end_io_hook,
  268. TP_PROTO(struct page *page, u64 start, u64 end, int uptodate),
  269. TP_ARGS(page, start, end, uptodate),
  270. TP_STRUCT__entry(
  271. __field( ino_t, ino )
  272. __field( pgoff_t, index )
  273. __field( u64, start )
  274. __field( u64, end )
  275. __field( int, uptodate )
  276. __field( u64, root_objectid )
  277. ),
  278. TP_fast_assign(
  279. __entry->ino = page->mapping->host->i_ino;
  280. __entry->index = page->index;
  281. __entry->start = start;
  282. __entry->end = end;
  283. __entry->uptodate = uptodate;
  284. __entry->root_objectid =
  285. BTRFS_I(page->mapping->host)->root->root_key.objectid;
  286. ),
  287. TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, "
  288. "end = %llu, uptodate = %d",
  289. show_root_type(__entry->root_objectid),
  290. (unsigned long)__entry->ino, (unsigned long)__entry->index,
  291. (unsigned long long)__entry->start,
  292. (unsigned long long)__entry->end, __entry->uptodate)
  293. );
  294. TRACE_EVENT(btrfs_sync_file,
  295. TP_PROTO(struct file *file, int datasync),
  296. TP_ARGS(file, datasync),
  297. TP_STRUCT__entry(
  298. __field( ino_t, ino )
  299. __field( ino_t, parent )
  300. __field( int, datasync )
  301. __field( u64, root_objectid )
  302. ),
  303. TP_fast_assign(
  304. struct dentry *dentry = file->f_path.dentry;
  305. struct inode *inode = dentry->d_inode;
  306. __entry->ino = inode->i_ino;
  307. __entry->parent = dentry->d_parent->d_inode->i_ino;
  308. __entry->datasync = datasync;
  309. __entry->root_objectid =
  310. BTRFS_I(inode)->root->root_key.objectid;
  311. ),
  312. TP_printk("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d",
  313. show_root_type(__entry->root_objectid),
  314. (unsigned long)__entry->ino, (unsigned long)__entry->parent,
  315. __entry->datasync)
  316. );
  317. TRACE_EVENT(btrfs_sync_fs,
  318. TP_PROTO(int wait),
  319. TP_ARGS(wait),
  320. TP_STRUCT__entry(
  321. __field( int, wait )
  322. ),
  323. TP_fast_assign(
  324. __entry->wait = wait;
  325. ),
  326. TP_printk("wait = %d", __entry->wait)
  327. );
  328. #define show_ref_action(action) \
  329. __print_symbolic(action, \
  330. { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \
  331. { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \
  332. { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \
  333. { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" })
  334. TRACE_EVENT(btrfs_delayed_tree_ref,
  335. TP_PROTO(struct btrfs_delayed_ref_node *ref,
  336. struct btrfs_delayed_tree_ref *full_ref,
  337. int action),
  338. TP_ARGS(ref, full_ref, action),
  339. TP_STRUCT__entry(
  340. __field( u64, bytenr )
  341. __field( u64, num_bytes )
  342. __field( int, action )
  343. __field( u64, parent )
  344. __field( u64, ref_root )
  345. __field( int, level )
  346. __field( int, type )
  347. ),
  348. TP_fast_assign(
  349. __entry->bytenr = ref->bytenr;
  350. __entry->num_bytes = ref->num_bytes;
  351. __entry->action = action;
  352. __entry->parent = full_ref->parent;
  353. __entry->ref_root = full_ref->root;
  354. __entry->level = full_ref->level;
  355. __entry->type = ref->type;
  356. ),
  357. TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
  358. "parent = %llu(%s), ref_root = %llu(%s), level = %d, "
  359. "type = %s",
  360. (unsigned long long)__entry->bytenr,
  361. (unsigned long long)__entry->num_bytes,
  362. show_ref_action(__entry->action),
  363. show_root_type(__entry->parent),
  364. show_root_type(__entry->ref_root),
  365. __entry->level, show_ref_type(__entry->type))
  366. );
  367. TRACE_EVENT(btrfs_delayed_data_ref,
  368. TP_PROTO(struct btrfs_delayed_ref_node *ref,
  369. struct btrfs_delayed_data_ref *full_ref,
  370. int action),
  371. TP_ARGS(ref, full_ref, action),
  372. TP_STRUCT__entry(
  373. __field( u64, bytenr )
  374. __field( u64, num_bytes )
  375. __field( int, action )
  376. __field( u64, parent )
  377. __field( u64, ref_root )
  378. __field( u64, owner )
  379. __field( u64, offset )
  380. __field( int, type )
  381. ),
  382. TP_fast_assign(
  383. __entry->bytenr = ref->bytenr;
  384. __entry->num_bytes = ref->num_bytes;
  385. __entry->action = action;
  386. __entry->parent = full_ref->parent;
  387. __entry->ref_root = full_ref->root;
  388. __entry->owner = full_ref->objectid;
  389. __entry->offset = full_ref->offset;
  390. __entry->type = ref->type;
  391. ),
  392. TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
  393. "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, "
  394. "offset = %llu, type = %s",
  395. (unsigned long long)__entry->bytenr,
  396. (unsigned long long)__entry->num_bytes,
  397. show_ref_action(__entry->action),
  398. show_root_type(__entry->parent),
  399. show_root_type(__entry->ref_root),
  400. (unsigned long long)__entry->owner,
  401. (unsigned long long)__entry->offset,
  402. show_ref_type(__entry->type))
  403. );
  404. TRACE_EVENT(btrfs_delayed_ref_head,
  405. TP_PROTO(struct btrfs_delayed_ref_node *ref,
  406. struct btrfs_delayed_ref_head *head_ref,
  407. int action),
  408. TP_ARGS(ref, head_ref, action),
  409. TP_STRUCT__entry(
  410. __field( u64, bytenr )
  411. __field( u64, num_bytes )
  412. __field( int, action )
  413. __field( int, is_data )
  414. ),
  415. TP_fast_assign(
  416. __entry->bytenr = ref->bytenr;
  417. __entry->num_bytes = ref->num_bytes;
  418. __entry->action = action;
  419. __entry->is_data = head_ref->is_data;
  420. ),
  421. TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d",
  422. (unsigned long long)__entry->bytenr,
  423. (unsigned long long)__entry->num_bytes,
  424. show_ref_action(__entry->action),
  425. __entry->is_data)
  426. );
  427. #define show_chunk_type(type) \
  428. __print_flags(type, "|", \
  429. { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \
  430. { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
  431. { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
  432. { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \
  433. { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \
  434. { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \
  435. { BTRFS_BLOCK_GROUP_RAID10, "RAID10"})
  436. DECLARE_EVENT_CLASS(btrfs__chunk,
  437. TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
  438. u64 offset, u64 size),
  439. TP_ARGS(root, map, offset, size),
  440. TP_STRUCT__entry(
  441. __field( int, num_stripes )
  442. __field( u64, type )
  443. __field( int, sub_stripes )
  444. __field( u64, offset )
  445. __field( u64, size )
  446. __field( u64, root_objectid )
  447. ),
  448. TP_fast_assign(
  449. __entry->num_stripes = map->num_stripes;
  450. __entry->type = map->type;
  451. __entry->sub_stripes = map->sub_stripes;
  452. __entry->offset = offset;
  453. __entry->size = size;
  454. __entry->root_objectid = root->root_key.objectid;
  455. ),
  456. TP_printk("root = %llu(%s), offset = %llu, size = %llu, "
  457. "num_stripes = %d, sub_stripes = %d, type = %s",
  458. show_root_type(__entry->root_objectid),
  459. (unsigned long long)__entry->offset,
  460. (unsigned long long)__entry->size,
  461. __entry->num_stripes, __entry->sub_stripes,
  462. show_chunk_type(__entry->type))
  463. );
  464. DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc,
  465. TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
  466. u64 offset, u64 size),
  467. TP_ARGS(root, map, offset, size)
  468. );
  469. DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free,
  470. TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
  471. u64 offset, u64 size),
  472. TP_ARGS(root, map, offset, size)
  473. );
  474. TRACE_EVENT(btrfs_cow_block,
  475. TP_PROTO(struct btrfs_root *root, struct extent_buffer *buf,
  476. struct extent_buffer *cow),
  477. TP_ARGS(root, buf, cow),
  478. TP_STRUCT__entry(
  479. __field( u64, root_objectid )
  480. __field( u64, buf_start )
  481. __field( int, refs )
  482. __field( u64, cow_start )
  483. __field( int, buf_level )
  484. __field( int, cow_level )
  485. ),
  486. TP_fast_assign(
  487. __entry->root_objectid = root->root_key.objectid;
  488. __entry->buf_start = buf->start;
  489. __entry->refs = atomic_read(&buf->refs);
  490. __entry->cow_start = cow->start;
  491. __entry->buf_level = btrfs_header_level(buf);
  492. __entry->cow_level = btrfs_header_level(cow);
  493. ),
  494. TP_printk("root = %llu(%s), refs = %d, orig_buf = %llu "
  495. "(orig_level = %d), cow_buf = %llu (cow_level = %d)",
  496. show_root_type(__entry->root_objectid),
  497. __entry->refs,
  498. (unsigned long long)__entry->buf_start,
  499. __entry->buf_level,
  500. (unsigned long long)__entry->cow_start,
  501. __entry->cow_level)
  502. );
  503. DECLARE_EVENT_CLASS(btrfs__reserved_extent,
  504. TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
  505. TP_ARGS(root, start, len),
  506. TP_STRUCT__entry(
  507. __field( u64, root_objectid )
  508. __field( u64, start )
  509. __field( u64, len )
  510. ),
  511. TP_fast_assign(
  512. __entry->root_objectid = root->root_key.objectid;
  513. __entry->start = start;
  514. __entry->len = len;
  515. ),
  516. TP_printk("root = %llu(%s), start = %llu, len = %llu",
  517. show_root_type(__entry->root_objectid),
  518. (unsigned long long)__entry->start,
  519. (unsigned long long)__entry->len)
  520. );
  521. DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc,
  522. TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
  523. TP_ARGS(root, start, len)
  524. );
  525. DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free,
  526. TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
  527. TP_ARGS(root, start, len)
  528. );
  529. #endif /* _TRACE_BTRFS_H */
  530. /* This part must be outside protection */
  531. #include <trace/define_trace.h>