486771e3f4cb1819c8e912ddc03cf0082e9731b8
[sfrench/cifs-2.6.git] / include / trace / events / btrfs.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM btrfs
4
5 #if !defined(_TRACE_BTRFS_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_BTRFS_H
7
8 #include <linux/writeback.h>
9 #include <linux/tracepoint.h>
10 #include <trace/events/mmflags.h>
11
12 struct btrfs_root;
13 struct btrfs_fs_info;
14 struct btrfs_inode;
15 struct extent_map;
16 struct btrfs_file_extent_item;
17 struct btrfs_ordered_extent;
18 struct btrfs_delayed_ref_node;
19 struct btrfs_delayed_tree_ref;
20 struct btrfs_delayed_data_ref;
21 struct btrfs_delayed_ref_head;
22 struct btrfs_block_group_cache;
23 struct btrfs_free_cluster;
24 struct map_lookup;
25 struct extent_buffer;
26 struct btrfs_work;
27 struct __btrfs_workqueue;
28 struct btrfs_qgroup_extent_record;
29 struct btrfs_qgroup;
30 struct prelim_ref;
31
32 TRACE_DEFINE_ENUM(FLUSH_DELAYED_ITEMS_NR);
33 TRACE_DEFINE_ENUM(FLUSH_DELAYED_ITEMS);
34 TRACE_DEFINE_ENUM(FLUSH_DELALLOC);
35 TRACE_DEFINE_ENUM(FLUSH_DELALLOC_WAIT);
36 TRACE_DEFINE_ENUM(ALLOC_CHUNK);
37 TRACE_DEFINE_ENUM(COMMIT_TRANS);
38
39 #define show_ref_type(type)                                             \
40         __print_symbolic(type,                                          \
41                 { BTRFS_TREE_BLOCK_REF_KEY,     "TREE_BLOCK_REF" },     \
42                 { BTRFS_EXTENT_DATA_REF_KEY,    "EXTENT_DATA_REF" },    \
43                 { BTRFS_EXTENT_REF_V0_KEY,      "EXTENT_REF_V0" },      \
44                 { BTRFS_SHARED_BLOCK_REF_KEY,   "SHARED_BLOCK_REF" },   \
45                 { BTRFS_SHARED_DATA_REF_KEY,    "SHARED_DATA_REF" })
46
47 #define __show_root_type(obj)                                           \
48         __print_symbolic_u64(obj,                                       \
49                 { BTRFS_ROOT_TREE_OBJECTID,     "ROOT_TREE"     },      \
50                 { BTRFS_EXTENT_TREE_OBJECTID,   "EXTENT_TREE"   },      \
51                 { BTRFS_CHUNK_TREE_OBJECTID,    "CHUNK_TREE"    },      \
52                 { BTRFS_DEV_TREE_OBJECTID,      "DEV_TREE"      },      \
53                 { BTRFS_FS_TREE_OBJECTID,       "FS_TREE"       },      \
54                 { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" },      \
55                 { BTRFS_CSUM_TREE_OBJECTID,     "CSUM_TREE"     },      \
56                 { BTRFS_TREE_LOG_OBJECTID,      "TREE_LOG"      },      \
57                 { BTRFS_QUOTA_TREE_OBJECTID,    "QUOTA_TREE"    },      \
58                 { BTRFS_TREE_RELOC_OBJECTID,    "TREE_RELOC"    },      \
59                 { BTRFS_UUID_TREE_OBJECTID,     "UUID_TREE"     },      \
60                 { BTRFS_FREE_SPACE_TREE_OBJECTID, "FREE_SPACE_TREE" },  \
61                 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
62
63 #define show_root_type(obj)                                             \
64         obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) ||                \
65               (obj >= BTRFS_ROOT_TREE_OBJECTID &&                       \
66                obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-"
67
68 #define show_fi_type(type)                                              \
69         __print_symbolic(type,                                          \
70                  { BTRFS_FILE_EXTENT_INLINE,    "INLINE" },             \
71                  { BTRFS_FILE_EXTENT_REG,       "REG"    },             \
72                  { BTRFS_FILE_EXTENT_PREALLOC,  "PREALLOC"})
73
74 #define BTRFS_GROUP_FLAGS       \
75         { BTRFS_BLOCK_GROUP_DATA,       "DATA"},        \
76         { BTRFS_BLOCK_GROUP_SYSTEM,     "SYSTEM"},      \
77         { BTRFS_BLOCK_GROUP_METADATA,   "METADATA"},    \
78         { BTRFS_BLOCK_GROUP_RAID0,      "RAID0"},       \
79         { BTRFS_BLOCK_GROUP_RAID1,      "RAID1"},       \
80         { BTRFS_BLOCK_GROUP_DUP,        "DUP"},         \
81         { BTRFS_BLOCK_GROUP_RAID10,     "RAID10"},      \
82         { BTRFS_BLOCK_GROUP_RAID5,      "RAID5"},       \
83         { BTRFS_BLOCK_GROUP_RAID6,      "RAID6"}
84
85 #define BTRFS_FSID_SIZE 16
86 #define TP_STRUCT__entry_fsid __array(u8, fsid, BTRFS_FSID_SIZE)
87
88 #define TP_fast_assign_fsid(fs_info)                                    \
89         memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE)
90
91 #define TP_STRUCT__entry_btrfs(args...)                                 \
92         TP_STRUCT__entry(                                               \
93                 TP_STRUCT__entry_fsid                                   \
94                 args)
95 #define TP_fast_assign_btrfs(fs_info, args...)                          \
96         TP_fast_assign(                                                 \
97                 TP_fast_assign_fsid(fs_info);                           \
98                 args)
99 #define TP_printk_btrfs(fmt, args...) \
100         TP_printk("%pU: " fmt, __entry->fsid, args)
101
102 TRACE_EVENT(btrfs_transaction_commit,
103
104         TP_PROTO(const struct btrfs_root *root),
105
106         TP_ARGS(root),
107
108         TP_STRUCT__entry_btrfs(
109                 __field(        u64,  generation                )
110                 __field(        u64,  root_objectid             )
111         ),
112
113         TP_fast_assign_btrfs(root->fs_info,
114                 __entry->generation     = root->fs_info->generation;
115                 __entry->root_objectid  = root->root_key.objectid;
116         ),
117
118         TP_printk_btrfs("root = %llu(%s), gen = %llu",
119                   show_root_type(__entry->root_objectid),
120                   (unsigned long long)__entry->generation)
121 );
122
123 DECLARE_EVENT_CLASS(btrfs__inode,
124
125         TP_PROTO(const struct inode *inode),
126
127         TP_ARGS(inode),
128
129         TP_STRUCT__entry_btrfs(
130                 __field(        ino_t,  ino                     )
131                 __field(        blkcnt_t,  blocks               )
132                 __field(        u64,  disk_i_size               )
133                 __field(        u64,  generation                )
134                 __field(        u64,  last_trans                )
135                 __field(        u64,  logged_trans              )
136                 __field(        u64,  root_objectid             )
137         ),
138
139         TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
140                 __entry->ino    = inode->i_ino;
141                 __entry->blocks = inode->i_blocks;
142                 __entry->disk_i_size  = BTRFS_I(inode)->disk_i_size;
143                 __entry->generation = BTRFS_I(inode)->generation;
144                 __entry->last_trans = BTRFS_I(inode)->last_trans;
145                 __entry->logged_trans = BTRFS_I(inode)->logged_trans;
146                 __entry->root_objectid =
147                                 BTRFS_I(inode)->root->root_key.objectid;
148         ),
149
150         TP_printk_btrfs("root=%llu(%s) gen=%llu ino=%lu blocks=%llu "
151                   "disk_i_size=%llu last_trans=%llu logged_trans=%llu",
152                   show_root_type(__entry->root_objectid),
153                   (unsigned long long)__entry->generation,
154                   (unsigned long)__entry->ino,
155                   (unsigned long long)__entry->blocks,
156                   (unsigned long long)__entry->disk_i_size,
157                   (unsigned long long)__entry->last_trans,
158                   (unsigned long long)__entry->logged_trans)
159 );
160
161 DEFINE_EVENT(btrfs__inode, btrfs_inode_new,
162
163         TP_PROTO(const struct inode *inode),
164
165         TP_ARGS(inode)
166 );
167
168 DEFINE_EVENT(btrfs__inode, btrfs_inode_request,
169
170         TP_PROTO(const struct inode *inode),
171
172         TP_ARGS(inode)
173 );
174
175 DEFINE_EVENT(btrfs__inode, btrfs_inode_evict,
176
177         TP_PROTO(const struct inode *inode),
178
179         TP_ARGS(inode)
180 );
181
182 #define __show_map_type(type)                                           \
183         __print_symbolic_u64(type,                                      \
184                 { EXTENT_MAP_LAST_BYTE, "LAST_BYTE"     },              \
185                 { EXTENT_MAP_HOLE,      "HOLE"          },              \
186                 { EXTENT_MAP_INLINE,    "INLINE"        },              \
187                 { EXTENT_MAP_DELALLOC,  "DELALLOC"      })
188
189 #define show_map_type(type)                     \
190         type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" :  __show_map_type(type)
191
192 #define show_map_flags(flag)                                            \
193         __print_flags(flag, "|",                                        \
194                 { (1 << EXTENT_FLAG_PINNED),            "PINNED"        },\
195                 { (1 << EXTENT_FLAG_COMPRESSED),        "COMPRESSED"    },\
196                 { (1 << EXTENT_FLAG_PREALLOC),          "PREALLOC"      },\
197                 { (1 << EXTENT_FLAG_LOGGING),           "LOGGING"       },\
198                 { (1 << EXTENT_FLAG_FILLING),           "FILLING"       },\
199                 { (1 << EXTENT_FLAG_FS_MAPPING),        "FS_MAPPING"    })
200
201 TRACE_EVENT_CONDITION(btrfs_get_extent,
202
203         TP_PROTO(const struct btrfs_root *root, const struct btrfs_inode *inode,
204                  const struct extent_map *map),
205
206         TP_ARGS(root, inode, map),
207
208         TP_CONDITION(map),
209
210         TP_STRUCT__entry_btrfs(
211                 __field(        u64,  root_objectid     )
212                 __field(        u64,  ino               )
213                 __field(        u64,  start             )
214                 __field(        u64,  len               )
215                 __field(        u64,  orig_start        )
216                 __field(        u64,  block_start       )
217                 __field(        u64,  block_len         )
218                 __field(        unsigned long,  flags   )
219                 __field(        int,  refs              )
220                 __field(        unsigned int,  compress_type    )
221         ),
222
223         TP_fast_assign_btrfs(root->fs_info,
224                 __entry->root_objectid  = root->root_key.objectid;
225                 __entry->ino            = btrfs_ino(inode);
226                 __entry->start          = map->start;
227                 __entry->len            = map->len;
228                 __entry->orig_start     = map->orig_start;
229                 __entry->block_start    = map->block_start;
230                 __entry->block_len      = map->block_len;
231                 __entry->flags          = map->flags;
232                 __entry->refs           = refcount_read(&map->refs);
233                 __entry->compress_type  = map->compress_type;
234         ),
235
236         TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu len=%llu "
237                   "orig_start=%llu block_start=%llu(%s) "
238                   "block_len=%llu flags=%s refs=%u "
239                   "compress_type=%u",
240                   show_root_type(__entry->root_objectid),
241                   (unsigned long long)__entry->ino,
242                   (unsigned long long)__entry->start,
243                   (unsigned long long)__entry->len,
244                   (unsigned long long)__entry->orig_start,
245                   show_map_type(__entry->block_start),
246                   (unsigned long long)__entry->block_len,
247                   show_map_flags(__entry->flags),
248                   __entry->refs, __entry->compress_type)
249 );
250
251 TRACE_EVENT(btrfs_handle_em_exist,
252
253         TP_PROTO(const struct extent_map *existing, const struct extent_map *map, u64 start, u64 len),
254
255         TP_ARGS(existing, map, start, len),
256
257         TP_STRUCT__entry(
258                 __field(        u64,  e_start           )
259                 __field(        u64,  e_len             )
260                 __field(        u64,  map_start         )
261                 __field(        u64,  map_len           )
262                 __field(        u64,  start             )
263                 __field(        u64,  len               )
264         ),
265
266         TP_fast_assign(
267                 __entry->e_start        = existing->start;
268                 __entry->e_len          = existing->len;
269                 __entry->map_start      = map->start;
270                 __entry->map_len        = map->len;
271                 __entry->start          = start;
272                 __entry->len            = len;
273         ),
274
275         TP_printk("start=%llu len=%llu "
276                   "existing(start=%llu len=%llu) "
277                   "em(start=%llu len=%llu)",
278                   (unsigned long long)__entry->start,
279                   (unsigned long long)__entry->len,
280                   (unsigned long long)__entry->e_start,
281                   (unsigned long long)__entry->e_len,
282                   (unsigned long long)__entry->map_start,
283                   (unsigned long long)__entry->map_len)
284 );
285
286 /* file extent item */
287 DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular,
288
289         TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
290                  struct btrfs_file_extent_item *fi, u64 start),
291
292         TP_ARGS(bi, l, fi, start),
293
294         TP_STRUCT__entry_btrfs(
295                 __field(        u64,    root_obj        )
296                 __field(        u64,    ino             )
297                 __field(        loff_t, isize           )
298                 __field(        u64,    disk_isize      )
299                 __field(        u64,    num_bytes       )
300                 __field(        u64,    ram_bytes       )
301                 __field(        u64,    disk_bytenr     )
302                 __field(        u64,    disk_num_bytes  )
303                 __field(        u64,    extent_offset   )
304                 __field(        u8,     extent_type     )
305                 __field(        u8,     compression     )
306                 __field(        u64,    extent_start    )
307                 __field(        u64,    extent_end      )
308         ),
309
310         TP_fast_assign_btrfs(bi->root->fs_info,
311                 __entry->root_obj       = bi->root->objectid;
312                 __entry->ino            = btrfs_ino(bi);
313                 __entry->isize          = bi->vfs_inode.i_size;
314                 __entry->disk_isize     = bi->disk_i_size;
315                 __entry->num_bytes      = btrfs_file_extent_num_bytes(l, fi);
316                 __entry->ram_bytes      = btrfs_file_extent_ram_bytes(l, fi);
317                 __entry->disk_bytenr    = btrfs_file_extent_disk_bytenr(l, fi);
318                 __entry->disk_num_bytes = btrfs_file_extent_disk_num_bytes(l, fi);
319                 __entry->extent_offset  = btrfs_file_extent_offset(l, fi);
320                 __entry->extent_type    = btrfs_file_extent_type(l, fi);
321                 __entry->compression    = btrfs_file_extent_compression(l, fi);
322                 __entry->extent_start   = start;
323                 __entry->extent_end     = (start + __entry->num_bytes);
324         ),
325
326         TP_printk_btrfs(
327                 "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu "
328                 "file extent range=[%llu %llu] "
329                 "(num_bytes=%llu ram_bytes=%llu disk_bytenr=%llu "
330                 "disk_num_bytes=%llu extent_offset=%llu type=%s "
331                 "compression=%u",
332                 show_root_type(__entry->root_obj), __entry->ino,
333                 __entry->isize,
334                 __entry->disk_isize, __entry->extent_start,
335                 __entry->extent_end, __entry->num_bytes, __entry->ram_bytes,
336                 __entry->disk_bytenr, __entry->disk_num_bytes,
337                 __entry->extent_offset, show_fi_type(__entry->extent_type),
338                 __entry->compression)
339 );
340
341 DECLARE_EVENT_CLASS(
342         btrfs__file_extent_item_inline,
343
344         TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
345                  struct btrfs_file_extent_item *fi, int slot, u64 start),
346
347         TP_ARGS(bi, l, fi, slot,  start),
348
349         TP_STRUCT__entry_btrfs(
350                 __field(        u64,    root_obj        )
351                 __field(        u64,    ino             )
352                 __field(        loff_t, isize           )
353                 __field(        u64,    disk_isize      )
354                 __field(        u8,     extent_type     )
355                 __field(        u8,     compression     )
356                 __field(        u64,    extent_start    )
357                 __field(        u64,    extent_end      )
358         ),
359
360         TP_fast_assign_btrfs(
361                 bi->root->fs_info,
362                 __entry->root_obj       = bi->root->objectid;
363                 __entry->ino            = btrfs_ino(bi);
364                 __entry->isize          = bi->vfs_inode.i_size;
365                 __entry->disk_isize     = bi->disk_i_size;
366                 __entry->extent_type    = btrfs_file_extent_type(l, fi);
367                 __entry->compression    = btrfs_file_extent_compression(l, fi);
368                 __entry->extent_start   = start;
369                 __entry->extent_end     = (start + btrfs_file_extent_inline_len(l, slot, fi));
370         ),
371
372         TP_printk_btrfs(
373                 "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu "
374                 "file extent range=[%llu %llu] "
375                 "extent_type=%s compression=%u",
376                 show_root_type(__entry->root_obj), __entry->ino, __entry->isize,
377                 __entry->disk_isize, __entry->extent_start,
378                 __entry->extent_end, show_fi_type(__entry->extent_type),
379                 __entry->compression)
380 );
381
382 DEFINE_EVENT(
383         btrfs__file_extent_item_regular, btrfs_get_extent_show_fi_regular,
384
385         TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
386                  struct btrfs_file_extent_item *fi, u64 start),
387
388         TP_ARGS(bi, l, fi, start)
389 );
390
391 DEFINE_EVENT(
392         btrfs__file_extent_item_regular, btrfs_truncate_show_fi_regular,
393
394         TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
395                  struct btrfs_file_extent_item *fi, u64 start),
396
397         TP_ARGS(bi, l, fi, start)
398 );
399
400 DEFINE_EVENT(
401         btrfs__file_extent_item_inline, btrfs_get_extent_show_fi_inline,
402
403         TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
404                  struct btrfs_file_extent_item *fi, int slot, u64 start),
405
406         TP_ARGS(bi, l, fi, slot, start)
407 );
408
409 DEFINE_EVENT(
410         btrfs__file_extent_item_inline, btrfs_truncate_show_fi_inline,
411
412         TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l,
413                  struct btrfs_file_extent_item *fi, int slot, u64 start),
414
415         TP_ARGS(bi, l, fi, slot, start)
416 );
417
418 #define show_ordered_flags(flags)                                          \
419         __print_flags(flags, "|",                                          \
420                 { (1 << BTRFS_ORDERED_IO_DONE),         "IO_DONE"       }, \
421                 { (1 << BTRFS_ORDERED_COMPLETE),        "COMPLETE"      }, \
422                 { (1 << BTRFS_ORDERED_NOCOW),           "NOCOW"         }, \
423                 { (1 << BTRFS_ORDERED_COMPRESSED),      "COMPRESSED"    }, \
424                 { (1 << BTRFS_ORDERED_PREALLOC),        "PREALLOC"      }, \
425                 { (1 << BTRFS_ORDERED_DIRECT),          "DIRECT"        }, \
426                 { (1 << BTRFS_ORDERED_IOERR),           "IOERR"         }, \
427                 { (1 << BTRFS_ORDERED_UPDATED_ISIZE),   "UPDATED_ISIZE" }, \
428                 { (1 << BTRFS_ORDERED_LOGGED_CSUM),     "LOGGED_CSUM"   }, \
429                 { (1 << BTRFS_ORDERED_TRUNCATED),       "TRUNCATED"     })
430
431
432 DECLARE_EVENT_CLASS(btrfs__ordered_extent,
433
434         TP_PROTO(const struct inode *inode,
435                  const struct btrfs_ordered_extent *ordered),
436
437         TP_ARGS(inode, ordered),
438
439         TP_STRUCT__entry_btrfs(
440                 __field(        ino_t,  ino             )
441                 __field(        u64,  file_offset       )
442                 __field(        u64,  start             )
443                 __field(        u64,  len               )
444                 __field(        u64,  disk_len          )
445                 __field(        u64,  bytes_left        )
446                 __field(        unsigned long,  flags   )
447                 __field(        int,  compress_type     )
448                 __field(        int,  refs              )
449                 __field(        u64,  root_objectid     )
450                 __field(        u64,  truncated_len     )
451         ),
452
453         TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
454                 __entry->ino            = inode->i_ino;
455                 __entry->file_offset    = ordered->file_offset;
456                 __entry->start          = ordered->start;
457                 __entry->len            = ordered->len;
458                 __entry->disk_len       = ordered->disk_len;
459                 __entry->bytes_left     = ordered->bytes_left;
460                 __entry->flags          = ordered->flags;
461                 __entry->compress_type  = ordered->compress_type;
462                 __entry->refs           = refcount_read(&ordered->refs);
463                 __entry->root_objectid  =
464                                 BTRFS_I(inode)->root->root_key.objectid;
465                 __entry->truncated_len  = ordered->truncated_len;
466         ),
467
468         TP_printk_btrfs("root=%llu(%s) ino=%llu file_offset=%llu "
469                   "start=%llu len=%llu disk_len=%llu "
470                   "truncated_len=%llu "
471                   "bytes_left=%llu flags=%s compress_type=%d "
472                   "refs=%d",
473                   show_root_type(__entry->root_objectid),
474                   (unsigned long long)__entry->ino,
475                   (unsigned long long)__entry->file_offset,
476                   (unsigned long long)__entry->start,
477                   (unsigned long long)__entry->len,
478                   (unsigned long long)__entry->disk_len,
479                   (unsigned long long)__entry->truncated_len,
480                   (unsigned long long)__entry->bytes_left,
481                   show_ordered_flags(__entry->flags),
482                   __entry->compress_type, __entry->refs)
483 );
484
485 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add,
486
487         TP_PROTO(const struct inode *inode,
488                  const struct btrfs_ordered_extent *ordered),
489
490         TP_ARGS(inode, ordered)
491 );
492
493 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove,
494
495         TP_PROTO(const struct inode *inode,
496                  const struct btrfs_ordered_extent *ordered),
497
498         TP_ARGS(inode, ordered)
499 );
500
501 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start,
502
503         TP_PROTO(const struct inode *inode,
504                  const struct btrfs_ordered_extent *ordered),
505
506         TP_ARGS(inode, ordered)
507 );
508
509 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put,
510
511         TP_PROTO(const struct inode *inode,
512                  const struct btrfs_ordered_extent *ordered),
513
514         TP_ARGS(inode, ordered)
515 );
516
517 DECLARE_EVENT_CLASS(btrfs__writepage,
518
519         TP_PROTO(const struct page *page, const struct inode *inode,
520                  const struct writeback_control *wbc),
521
522         TP_ARGS(page, inode, wbc),
523
524         TP_STRUCT__entry_btrfs(
525                 __field(        ino_t,  ino                     )
526                 __field(        pgoff_t,  index                 )
527                 __field(        long,   nr_to_write             )
528                 __field(        long,   pages_skipped           )
529                 __field(        loff_t, range_start             )
530                 __field(        loff_t, range_end               )
531                 __field(        char,   for_kupdate             )
532                 __field(        char,   for_reclaim             )
533                 __field(        char,   range_cyclic            )
534                 __field(        pgoff_t,  writeback_index       )
535                 __field(        u64,    root_objectid           )
536         ),
537
538         TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
539                 __entry->ino            = inode->i_ino;
540                 __entry->index          = page->index;
541                 __entry->nr_to_write    = wbc->nr_to_write;
542                 __entry->pages_skipped  = wbc->pages_skipped;
543                 __entry->range_start    = wbc->range_start;
544                 __entry->range_end      = wbc->range_end;
545                 __entry->for_kupdate    = wbc->for_kupdate;
546                 __entry->for_reclaim    = wbc->for_reclaim;
547                 __entry->range_cyclic   = wbc->range_cyclic;
548                 __entry->writeback_index = inode->i_mapping->writeback_index;
549                 __entry->root_objectid  =
550                                  BTRFS_I(inode)->root->root_key.objectid;
551         ),
552
553         TP_printk_btrfs("root=%llu(%s) ino=%lu page_index=%lu "
554                   "nr_to_write=%ld pages_skipped=%ld range_start=%llu "
555                   "range_end=%llu for_kupdate=%d "
556                   "for_reclaim=%d range_cyclic=%d writeback_index=%lu",
557                   show_root_type(__entry->root_objectid),
558                   (unsigned long)__entry->ino, __entry->index,
559                   __entry->nr_to_write, __entry->pages_skipped,
560                   __entry->range_start, __entry->range_end,
561                   __entry->for_kupdate,
562                   __entry->for_reclaim, __entry->range_cyclic,
563                   (unsigned long)__entry->writeback_index)
564 );
565
566 DEFINE_EVENT(btrfs__writepage, __extent_writepage,
567
568         TP_PROTO(const struct page *page, const struct inode *inode,
569                  const struct writeback_control *wbc),
570
571         TP_ARGS(page, inode, wbc)
572 );
573
574 TRACE_EVENT(btrfs_writepage_end_io_hook,
575
576         TP_PROTO(const struct page *page, u64 start, u64 end, int uptodate),
577
578         TP_ARGS(page, start, end, uptodate),
579
580         TP_STRUCT__entry_btrfs(
581                 __field(        ino_t,   ino            )
582                 __field(        pgoff_t, index          )
583                 __field(        u64,     start          )
584                 __field(        u64,     end            )
585                 __field(        int,     uptodate       )
586                 __field(        u64,    root_objectid   )
587         ),
588
589         TP_fast_assign_btrfs(btrfs_sb(page->mapping->host->i_sb),
590                 __entry->ino    = page->mapping->host->i_ino;
591                 __entry->index  = page->index;
592                 __entry->start  = start;
593                 __entry->end    = end;
594                 __entry->uptodate = uptodate;
595                 __entry->root_objectid  =
596                          BTRFS_I(page->mapping->host)->root->root_key.objectid;
597         ),
598
599         TP_printk_btrfs("root=%llu(%s) ino=%lu page_index=%lu start=%llu "
600                   "end=%llu uptodate=%d",
601                   show_root_type(__entry->root_objectid),
602                   (unsigned long)__entry->ino, (unsigned long)__entry->index,
603                   (unsigned long long)__entry->start,
604                   (unsigned long long)__entry->end, __entry->uptodate)
605 );
606
607 TRACE_EVENT(btrfs_sync_file,
608
609         TP_PROTO(const struct file *file, int datasync),
610
611         TP_ARGS(file, datasync),
612
613         TP_STRUCT__entry_btrfs(
614                 __field(        ino_t,  ino             )
615                 __field(        ino_t,  parent          )
616                 __field(        int,    datasync        )
617                 __field(        u64,    root_objectid   )
618         ),
619
620         TP_fast_assign(
621                 const struct dentry *dentry = file->f_path.dentry;
622                 const struct inode *inode = d_inode(dentry);
623
624                 TP_fast_assign_fsid(btrfs_sb(file->f_path.dentry->d_sb));
625                 __entry->ino            = inode->i_ino;
626                 __entry->parent         = d_inode(dentry->d_parent)->i_ino;
627                 __entry->datasync       = datasync;
628                 __entry->root_objectid  =
629                                  BTRFS_I(inode)->root->root_key.objectid;
630         ),
631
632         TP_printk_btrfs("root=%llu(%s) ino=%ld parent=%ld datasync=%d",
633                   show_root_type(__entry->root_objectid),
634                   (unsigned long)__entry->ino, (unsigned long)__entry->parent,
635                   __entry->datasync)
636 );
637
638 TRACE_EVENT(btrfs_sync_fs,
639
640         TP_PROTO(const struct btrfs_fs_info *fs_info, int wait),
641
642         TP_ARGS(fs_info, wait),
643
644         TP_STRUCT__entry_btrfs(
645                 __field(        int,  wait              )
646         ),
647
648         TP_fast_assign_btrfs(fs_info,
649                 __entry->wait   = wait;
650         ),
651
652         TP_printk_btrfs("wait = %d", __entry->wait)
653 );
654
655 TRACE_EVENT(btrfs_add_block_group,
656
657         TP_PROTO(const struct btrfs_fs_info *fs_info,
658                  const struct btrfs_block_group_cache *block_group, int create),
659
660         TP_ARGS(fs_info, block_group, create),
661
662         TP_STRUCT__entry(
663                 __array(        u8,     fsid,   BTRFS_FSID_SIZE )
664                 __field(        u64,    offset                  )
665                 __field(        u64,    size                    )
666                 __field(        u64,    flags                   )
667                 __field(        u64,    bytes_used              )
668                 __field(        u64,    bytes_super             )
669                 __field(        int,    create                  )
670         ),
671
672         TP_fast_assign(
673                 memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE);
674                 __entry->offset         = block_group->key.objectid;
675                 __entry->size           = block_group->key.offset;
676                 __entry->flags          = block_group->flags;
677                 __entry->bytes_used     =
678                         btrfs_block_group_used(&block_group->item);
679                 __entry->bytes_super    = block_group->bytes_super;
680                 __entry->create         = create;
681         ),
682
683         TP_printk("%pU: block_group offset=%llu size=%llu "
684                   "flags=%llu(%s) bytes_used=%llu bytes_super=%llu "
685                   "create=%d", __entry->fsid,
686                   (unsigned long long)__entry->offset,
687                   (unsigned long long)__entry->size,
688                   (unsigned long long)__entry->flags,
689                   __print_flags((unsigned long)__entry->flags, "|",
690                                 BTRFS_GROUP_FLAGS),
691                   (unsigned long long)__entry->bytes_used,
692                   (unsigned long long)__entry->bytes_super, __entry->create)
693 );
694
695 #define show_ref_action(action)                                         \
696         __print_symbolic(action,                                        \
697                 { BTRFS_ADD_DELAYED_REF,    "ADD_DELAYED_REF" },        \
698                 { BTRFS_DROP_DELAYED_REF,   "DROP_DELAYED_REF" },       \
699                 { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" },     \
700                 { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" })
701                         
702
703 DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref,
704
705         TP_PROTO(const struct btrfs_fs_info *fs_info,
706                  const struct btrfs_delayed_ref_node *ref,
707                  const struct btrfs_delayed_tree_ref *full_ref,
708                  int action),
709
710         TP_ARGS(fs_info, ref, full_ref, action),
711
712         TP_STRUCT__entry_btrfs(
713                 __field(        u64,  bytenr            )
714                 __field(        u64,  num_bytes         )
715                 __field(        int,  action            ) 
716                 __field(        u64,  parent            )
717                 __field(        u64,  ref_root          )
718                 __field(        int,  level             )
719                 __field(        int,  type              )
720                 __field(        u64,  seq               )
721         ),
722
723         TP_fast_assign_btrfs(fs_info,
724                 __entry->bytenr         = ref->bytenr;
725                 __entry->num_bytes      = ref->num_bytes;
726                 __entry->action         = action;
727                 __entry->parent         = full_ref->parent;
728                 __entry->ref_root       = full_ref->root;
729                 __entry->level          = full_ref->level;
730                 __entry->type           = ref->type;
731                 __entry->seq            = ref->seq;
732         ),
733
734         TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s "
735                   "parent=%llu(%s) ref_root=%llu(%s) level=%d "
736                   "type=%s seq=%llu",
737                   (unsigned long long)__entry->bytenr,
738                   (unsigned long long)__entry->num_bytes,
739                   show_ref_action(__entry->action),
740                   show_root_type(__entry->parent),
741                   show_root_type(__entry->ref_root),
742                   __entry->level, show_ref_type(__entry->type),
743                   (unsigned long long)__entry->seq)
744 );
745
746 DEFINE_EVENT(btrfs_delayed_tree_ref,  add_delayed_tree_ref,
747
748         TP_PROTO(const struct btrfs_fs_info *fs_info,
749                  const struct btrfs_delayed_ref_node *ref,
750                  const struct btrfs_delayed_tree_ref *full_ref,
751                  int action),
752
753         TP_ARGS(fs_info, ref, full_ref, action)
754 );
755
756 DEFINE_EVENT(btrfs_delayed_tree_ref,  run_delayed_tree_ref,
757
758         TP_PROTO(const struct btrfs_fs_info *fs_info,
759                  const struct btrfs_delayed_ref_node *ref,
760                  const struct btrfs_delayed_tree_ref *full_ref,
761                  int action),
762
763         TP_ARGS(fs_info, ref, full_ref, action)
764 );
765
766 DECLARE_EVENT_CLASS(btrfs_delayed_data_ref,
767
768         TP_PROTO(const struct btrfs_fs_info *fs_info,
769                  const struct btrfs_delayed_ref_node *ref,
770                  const struct btrfs_delayed_data_ref *full_ref,
771                  int action),
772
773         TP_ARGS(fs_info, ref, full_ref, action),
774
775         TP_STRUCT__entry_btrfs(
776                 __field(        u64,  bytenr            )
777                 __field(        u64,  num_bytes         )
778                 __field(        int,  action            ) 
779                 __field(        u64,  parent            )
780                 __field(        u64,  ref_root          )
781                 __field(        u64,  owner             )
782                 __field(        u64,  offset            )
783                 __field(        int,  type              )
784                 __field(        u64,  seq               )
785         ),
786
787         TP_fast_assign_btrfs(fs_info,
788                 __entry->bytenr         = ref->bytenr;
789                 __entry->num_bytes      = ref->num_bytes;
790                 __entry->action         = action;
791                 __entry->parent         = full_ref->parent;
792                 __entry->ref_root       = full_ref->root;
793                 __entry->owner          = full_ref->objectid;
794                 __entry->offset         = full_ref->offset;
795                 __entry->type           = ref->type;
796                 __entry->seq            = ref->seq;
797         ),
798
799         TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s "
800                   "parent=%llu(%s) ref_root=%llu(%s) owner=%llu "
801                   "offset=%llu type=%s seq=%llu",
802                   (unsigned long long)__entry->bytenr,
803                   (unsigned long long)__entry->num_bytes,
804                   show_ref_action(__entry->action),
805                   show_root_type(__entry->parent),
806                   show_root_type(__entry->ref_root),
807                   (unsigned long long)__entry->owner,
808                   (unsigned long long)__entry->offset,
809                   show_ref_type(__entry->type),
810                   (unsigned long long)__entry->seq)
811 );
812
813 DEFINE_EVENT(btrfs_delayed_data_ref,  add_delayed_data_ref,
814
815         TP_PROTO(const struct btrfs_fs_info *fs_info,
816                  const struct btrfs_delayed_ref_node *ref,
817                  const struct btrfs_delayed_data_ref *full_ref,
818                  int action),
819
820         TP_ARGS(fs_info, ref, full_ref, action)
821 );
822
823 DEFINE_EVENT(btrfs_delayed_data_ref,  run_delayed_data_ref,
824
825         TP_PROTO(const struct btrfs_fs_info *fs_info,
826                  const struct btrfs_delayed_ref_node *ref,
827                  const struct btrfs_delayed_data_ref *full_ref,
828                  int action),
829
830         TP_ARGS(fs_info, ref, full_ref, action)
831 );
832
833 DECLARE_EVENT_CLASS(btrfs_delayed_ref_head,
834
835         TP_PROTO(const struct btrfs_fs_info *fs_info,
836                  const struct btrfs_delayed_ref_head *head_ref,
837                  int action),
838
839         TP_ARGS(fs_info, head_ref, action),
840
841         TP_STRUCT__entry_btrfs(
842                 __field(        u64,  bytenr            )
843                 __field(        u64,  num_bytes         )
844                 __field(        int,  action            ) 
845                 __field(        int,  is_data           )
846         ),
847
848         TP_fast_assign_btrfs(fs_info,
849                 __entry->bytenr         = head_ref->bytenr;
850                 __entry->num_bytes      = head_ref->num_bytes;
851                 __entry->action         = action;
852                 __entry->is_data        = head_ref->is_data;
853         ),
854
855         TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s is_data=%d",
856                   (unsigned long long)__entry->bytenr,
857                   (unsigned long long)__entry->num_bytes,
858                   show_ref_action(__entry->action),
859                   __entry->is_data)
860 );
861
862 DEFINE_EVENT(btrfs_delayed_ref_head,  add_delayed_ref_head,
863
864         TP_PROTO(const struct btrfs_fs_info *fs_info,
865                  const struct btrfs_delayed_ref_head *head_ref,
866                  int action),
867
868         TP_ARGS(fs_info, head_ref, action)
869 );
870
871 DEFINE_EVENT(btrfs_delayed_ref_head,  run_delayed_ref_head,
872
873         TP_PROTO(const struct btrfs_fs_info *fs_info,
874                  const struct btrfs_delayed_ref_head *head_ref,
875                  int action),
876
877         TP_ARGS(fs_info, head_ref, action)
878 );
879
880 #define show_chunk_type(type)                                   \
881         __print_flags(type, "|",                                \
882                 { BTRFS_BLOCK_GROUP_DATA,       "DATA"  },      \
883                 { BTRFS_BLOCK_GROUP_SYSTEM,     "SYSTEM"},      \
884                 { BTRFS_BLOCK_GROUP_METADATA,   "METADATA"},    \
885                 { BTRFS_BLOCK_GROUP_RAID0,      "RAID0" },      \
886                 { BTRFS_BLOCK_GROUP_RAID1,      "RAID1" },      \
887                 { BTRFS_BLOCK_GROUP_DUP,        "DUP"   },      \
888                 { BTRFS_BLOCK_GROUP_RAID10,     "RAID10"},      \
889                 { BTRFS_BLOCK_GROUP_RAID5,      "RAID5" },      \
890                 { BTRFS_BLOCK_GROUP_RAID6,      "RAID6" })
891
892 DECLARE_EVENT_CLASS(btrfs__chunk,
893
894         TP_PROTO(const struct btrfs_fs_info *fs_info,
895                  const struct map_lookup *map, u64 offset, u64 size),
896
897         TP_ARGS(fs_info, map, offset, size),
898
899         TP_STRUCT__entry_btrfs(
900                 __field(        int,  num_stripes               )
901                 __field(        u64,  type                      )
902                 __field(        int,  sub_stripes               )
903                 __field(        u64,  offset                    )
904                 __field(        u64,  size                      )
905                 __field(        u64,  root_objectid             )
906         ),
907
908         TP_fast_assign_btrfs(fs_info,
909                 __entry->num_stripes    = map->num_stripes;
910                 __entry->type           = map->type;
911                 __entry->sub_stripes    = map->sub_stripes;
912                 __entry->offset         = offset;
913                 __entry->size           = size;
914                 __entry->root_objectid  = fs_info->chunk_root->root_key.objectid;
915         ),
916
917         TP_printk_btrfs("root=%llu(%s) offset=%llu size=%llu "
918                   "num_stripes=%d sub_stripes=%d type=%s",
919                   show_root_type(__entry->root_objectid),
920                   (unsigned long long)__entry->offset,
921                   (unsigned long long)__entry->size,
922                   __entry->num_stripes, __entry->sub_stripes,
923                   show_chunk_type(__entry->type))
924 );
925
926 DEFINE_EVENT(btrfs__chunk,  btrfs_chunk_alloc,
927
928         TP_PROTO(const struct btrfs_fs_info *fs_info,
929                  const struct map_lookup *map, u64 offset, u64 size),
930
931         TP_ARGS(fs_info, map, offset, size)
932 );
933
934 DEFINE_EVENT(btrfs__chunk,  btrfs_chunk_free,
935
936         TP_PROTO(const struct btrfs_fs_info *fs_info,
937                  const struct map_lookup *map, u64 offset, u64 size),
938
939         TP_ARGS(fs_info, map, offset, size)
940 );
941
942 TRACE_EVENT(btrfs_cow_block,
943
944         TP_PROTO(const struct btrfs_root *root, const struct extent_buffer *buf,
945                  const struct extent_buffer *cow),
946
947         TP_ARGS(root, buf, cow),
948
949         TP_STRUCT__entry_btrfs(
950                 __field(        u64,  root_objectid             )
951                 __field(        u64,  buf_start                 )
952                 __field(        int,  refs                      )
953                 __field(        u64,  cow_start                 )
954                 __field(        int,  buf_level                 )
955                 __field(        int,  cow_level                 )
956         ),
957
958         TP_fast_assign_btrfs(root->fs_info,
959                 __entry->root_objectid  = root->root_key.objectid;
960                 __entry->buf_start      = buf->start;
961                 __entry->refs           = atomic_read(&buf->refs);
962                 __entry->cow_start      = cow->start;
963                 __entry->buf_level      = btrfs_header_level(buf);
964                 __entry->cow_level      = btrfs_header_level(cow);
965         ),
966
967         TP_printk_btrfs("root=%llu(%s) refs=%d orig_buf=%llu "
968                   "(orig_level=%d) cow_buf=%llu (cow_level=%d)",
969                   show_root_type(__entry->root_objectid),
970                   __entry->refs,
971                   (unsigned long long)__entry->buf_start,
972                   __entry->buf_level,
973                   (unsigned long long)__entry->cow_start,
974                   __entry->cow_level)
975 );
976
977 TRACE_EVENT(btrfs_space_reservation,
978
979         TP_PROTO(const struct btrfs_fs_info *fs_info, char *type, u64 val,
980                  u64 bytes, int reserve),
981
982         TP_ARGS(fs_info, type, val, bytes, reserve),
983
984         TP_STRUCT__entry_btrfs(
985                 __string(       type,   type                    )
986                 __field(        u64,    val                     )
987                 __field(        u64,    bytes                   )
988                 __field(        int,    reserve                 )
989         ),
990
991         TP_fast_assign_btrfs(fs_info,
992                 __assign_str(type, type);
993                 __entry->val            = val;
994                 __entry->bytes          = bytes;
995                 __entry->reserve        = reserve;
996         ),
997
998         TP_printk_btrfs("%s: %Lu %s %Lu", __get_str(type), __entry->val,
999                         __entry->reserve ? "reserve" : "release",
1000                         __entry->bytes)
1001 );
1002
1003 #define show_flush_action(action)                                               \
1004         __print_symbolic(action,                                                \
1005                 { BTRFS_RESERVE_NO_FLUSH,       "BTRFS_RESERVE_NO_FLUSH"},      \
1006                 { BTRFS_RESERVE_FLUSH_LIMIT,    "BTRFS_RESERVE_FLUSH_LIMIT"},   \
1007                 { BTRFS_RESERVE_FLUSH_ALL,      "BTRFS_RESERVE_FLUSH_ALL"})
1008
1009 TRACE_EVENT(btrfs_trigger_flush,
1010
1011         TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes,
1012                  int flush, char *reason),
1013
1014         TP_ARGS(fs_info, flags, bytes, flush, reason),
1015
1016         TP_STRUCT__entry(
1017                 __array(        u8,     fsid,   BTRFS_FSID_SIZE )
1018                 __field(        u64,    flags                   )
1019                 __field(        u64,    bytes                   )
1020                 __field(        int,    flush                   )
1021                 __string(       reason, reason                  )
1022         ),
1023
1024         TP_fast_assign(
1025                 memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE);
1026                 __entry->flags  = flags;
1027                 __entry->bytes  = bytes;
1028                 __entry->flush  = flush;
1029                 __assign_str(reason, reason)
1030         ),
1031
1032         TP_printk("%pU: %s: flush=%d(%s) flags=%llu(%s) bytes=%llu",
1033                   __entry->fsid, __get_str(reason), __entry->flush,
1034                   show_flush_action(__entry->flush),
1035                   (unsigned long long)__entry->flags,
1036                   __print_flags((unsigned long)__entry->flags, "|",
1037                                 BTRFS_GROUP_FLAGS),
1038                   (unsigned long long)__entry->bytes)
1039 );
1040
1041 #define show_flush_state(state)                                                 \
1042         __print_symbolic(state,                                                 \
1043                 { FLUSH_DELAYED_ITEMS_NR,       "FLUSH_DELAYED_ITEMS_NR"},      \
1044                 { FLUSH_DELAYED_ITEMS,          "FLUSH_DELAYED_ITEMS"},         \
1045                 { FLUSH_DELALLOC,               "FLUSH_DELALLOC"},              \
1046                 { FLUSH_DELALLOC_WAIT,          "FLUSH_DELALLOC_WAIT"},         \
1047                 { ALLOC_CHUNK,                  "ALLOC_CHUNK"},                 \
1048                 { COMMIT_TRANS,                 "COMMIT_TRANS"})
1049
1050 TRACE_EVENT(btrfs_flush_space,
1051
1052         TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 num_bytes,
1053                  int state, int ret),
1054
1055         TP_ARGS(fs_info, flags, num_bytes, state, ret),
1056
1057         TP_STRUCT__entry(
1058                 __array(        u8,     fsid,   BTRFS_FSID_SIZE )
1059                 __field(        u64,    flags                   )
1060                 __field(        u64,    num_bytes               )
1061                 __field(        int,    state                   )
1062                 __field(        int,    ret                     )
1063         ),
1064
1065         TP_fast_assign(
1066                 memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE);
1067                 __entry->flags          =       flags;
1068                 __entry->num_bytes      =       num_bytes;
1069                 __entry->state          =       state;
1070                 __entry->ret            =       ret;
1071         ),
1072
1073         TP_printk("%pU: state=%d(%s) flags=%llu(%s) num_bytes=%llu ret=%d",
1074                   __entry->fsid, __entry->state,
1075                   show_flush_state(__entry->state),
1076                   (unsigned long long)__entry->flags,
1077                   __print_flags((unsigned long)__entry->flags, "|",
1078                                 BTRFS_GROUP_FLAGS),
1079                   (unsigned long long)__entry->num_bytes, __entry->ret)
1080 );
1081
1082 DECLARE_EVENT_CLASS(btrfs__reserved_extent,
1083
1084         TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len),
1085
1086         TP_ARGS(fs_info, start, len),
1087
1088         TP_STRUCT__entry_btrfs(
1089                 __field(        u64,  start                     )
1090                 __field(        u64,  len                       )
1091         ),
1092
1093         TP_fast_assign_btrfs(fs_info,
1094                 __entry->start          = start;
1095                 __entry->len            = len;
1096         ),
1097
1098         TP_printk_btrfs("root=%llu(%s) start=%llu len=%llu",
1099                   show_root_type(BTRFS_EXTENT_TREE_OBJECTID),
1100                   (unsigned long long)__entry->start,
1101                   (unsigned long long)__entry->len)
1102 );
1103
1104 DEFINE_EVENT(btrfs__reserved_extent,  btrfs_reserved_extent_alloc,
1105
1106         TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len),
1107
1108         TP_ARGS(fs_info, start, len)
1109 );
1110
1111 DEFINE_EVENT(btrfs__reserved_extent,  btrfs_reserved_extent_free,
1112
1113         TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len),
1114
1115         TP_ARGS(fs_info, start, len)
1116 );
1117
1118 TRACE_EVENT(find_free_extent,
1119
1120         TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes,
1121                  u64 empty_size, u64 data),
1122
1123         TP_ARGS(fs_info, num_bytes, empty_size, data),
1124
1125         TP_STRUCT__entry_btrfs(
1126                 __field(        u64,    num_bytes               )
1127                 __field(        u64,    empty_size              )
1128                 __field(        u64,    data                    )
1129         ),
1130
1131         TP_fast_assign_btrfs(fs_info,
1132                 __entry->num_bytes      = num_bytes;
1133                 __entry->empty_size     = empty_size;
1134                 __entry->data           = data;
1135         ),
1136
1137         TP_printk_btrfs("root=%Lu(%s) len=%Lu empty_size=%Lu flags=%Lu(%s)",
1138                   show_root_type(BTRFS_EXTENT_TREE_OBJECTID),
1139                   __entry->num_bytes, __entry->empty_size, __entry->data,
1140                   __print_flags((unsigned long)__entry->data, "|",
1141                                  BTRFS_GROUP_FLAGS))
1142 );
1143
1144 DECLARE_EVENT_CLASS(btrfs__reserve_extent,
1145
1146         TP_PROTO(const struct btrfs_fs_info *fs_info,
1147                  const struct btrfs_block_group_cache *block_group, u64 start,
1148                  u64 len),
1149
1150         TP_ARGS(fs_info, block_group, start, len),
1151
1152         TP_STRUCT__entry_btrfs(
1153                 __field(        u64,    bg_objectid             )
1154                 __field(        u64,    flags                   )
1155                 __field(        u64,    start                   )
1156                 __field(        u64,    len                     )
1157         ),
1158
1159         TP_fast_assign_btrfs(fs_info,
1160                 __entry->bg_objectid    = block_group->key.objectid;
1161                 __entry->flags          = block_group->flags;
1162                 __entry->start          = start;
1163                 __entry->len            = len;
1164         ),
1165
1166         TP_printk_btrfs("root=%Lu(%s) block_group=%Lu flags=%Lu(%s) "
1167                   "start=%Lu len=%Lu",
1168                   show_root_type(BTRFS_EXTENT_TREE_OBJECTID),
1169                   __entry->bg_objectid,
1170                   __entry->flags, __print_flags((unsigned long)__entry->flags,
1171                                                 "|", BTRFS_GROUP_FLAGS),
1172                   __entry->start, __entry->len)
1173 );
1174
1175 DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent,
1176
1177         TP_PROTO(const struct btrfs_fs_info *fs_info,
1178                  const struct btrfs_block_group_cache *block_group, u64 start,
1179                  u64 len),
1180
1181         TP_ARGS(fs_info, block_group, start, len)
1182 );
1183
1184 DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster,
1185
1186         TP_PROTO(const struct btrfs_fs_info *fs_info,
1187                  const struct btrfs_block_group_cache *block_group, u64 start,
1188                  u64 len),
1189
1190         TP_ARGS(fs_info, block_group, start, len)
1191 );
1192
1193 TRACE_EVENT(btrfs_find_cluster,
1194
1195         TP_PROTO(const struct btrfs_block_group_cache *block_group, u64 start,
1196                  u64 bytes, u64 empty_size, u64 min_bytes),
1197
1198         TP_ARGS(block_group, start, bytes, empty_size, min_bytes),
1199
1200         TP_STRUCT__entry_btrfs(
1201                 __field(        u64,    bg_objectid             )
1202                 __field(        u64,    flags                   )
1203                 __field(        u64,    start                   )
1204                 __field(        u64,    bytes                   )
1205                 __field(        u64,    empty_size              )
1206                 __field(        u64,    min_bytes               )
1207         ),
1208
1209         TP_fast_assign_btrfs(block_group->fs_info,
1210                 __entry->bg_objectid    = block_group->key.objectid;
1211                 __entry->flags          = block_group->flags;
1212                 __entry->start          = start;
1213                 __entry->bytes          = bytes;
1214                 __entry->empty_size     = empty_size;
1215                 __entry->min_bytes      = min_bytes;
1216         ),
1217
1218         TP_printk_btrfs("block_group=%Lu flags=%Lu(%s) start=%Lu len=%Lu "
1219                   "empty_size=%Lu min_bytes=%Lu", __entry->bg_objectid,
1220                   __entry->flags,
1221                   __print_flags((unsigned long)__entry->flags, "|",
1222                                 BTRFS_GROUP_FLAGS), __entry->start,
1223                   __entry->bytes, __entry->empty_size,  __entry->min_bytes)
1224 );
1225
1226 TRACE_EVENT(btrfs_failed_cluster_setup,
1227
1228         TP_PROTO(const struct btrfs_block_group_cache *block_group),
1229
1230         TP_ARGS(block_group),
1231
1232         TP_STRUCT__entry_btrfs(
1233                 __field(        u64,    bg_objectid             )
1234         ),
1235
1236         TP_fast_assign_btrfs(block_group->fs_info,
1237                 __entry->bg_objectid    = block_group->key.objectid;
1238         ),
1239
1240         TP_printk_btrfs("block_group=%Lu", __entry->bg_objectid)
1241 );
1242
1243 TRACE_EVENT(btrfs_setup_cluster,
1244
1245         TP_PROTO(const struct btrfs_block_group_cache *block_group,
1246                  const struct btrfs_free_cluster *cluster,
1247                  u64 size, int bitmap),
1248
1249         TP_ARGS(block_group, cluster, size, bitmap),
1250
1251         TP_STRUCT__entry_btrfs(
1252                 __field(        u64,    bg_objectid             )
1253                 __field(        u64,    flags                   )
1254                 __field(        u64,    start                   )
1255                 __field(        u64,    max_size                )
1256                 __field(        u64,    size                    )
1257                 __field(        int,    bitmap                  )
1258         ),
1259
1260         TP_fast_assign_btrfs(block_group->fs_info,
1261                 __entry->bg_objectid    = block_group->key.objectid;
1262                 __entry->flags          = block_group->flags;
1263                 __entry->start          = cluster->window_start;
1264                 __entry->max_size       = cluster->max_size;
1265                 __entry->size           = size;
1266                 __entry->bitmap         = bitmap;
1267         ),
1268
1269         TP_printk_btrfs("block_group=%Lu flags=%Lu(%s) window_start=%Lu "
1270                   "size=%Lu max_size=%Lu bitmap=%d",
1271                   __entry->bg_objectid,
1272                   __entry->flags,
1273                   __print_flags((unsigned long)__entry->flags, "|",
1274                                 BTRFS_GROUP_FLAGS), __entry->start,
1275                   __entry->size, __entry->max_size, __entry->bitmap)
1276 );
1277
1278 struct extent_state;
1279 TRACE_EVENT(alloc_extent_state,
1280
1281         TP_PROTO(const struct extent_state *state,
1282                  gfp_t mask, unsigned long IP),
1283
1284         TP_ARGS(state, mask, IP),
1285
1286         TP_STRUCT__entry(
1287                 __field(const struct extent_state *, state)
1288                 __field(gfp_t, mask)
1289                 __field(unsigned long, ip)
1290         ),
1291
1292         TP_fast_assign(
1293                 __entry->state  = state,
1294                 __entry->mask   = mask,
1295                 __entry->ip     = IP
1296         ),
1297
1298         TP_printk("state=%p mask=%s caller=%pS", __entry->state,
1299                   show_gfp_flags(__entry->mask), (const void *)__entry->ip)
1300 );
1301
1302 TRACE_EVENT(free_extent_state,
1303
1304         TP_PROTO(const struct extent_state *state, unsigned long IP),
1305
1306         TP_ARGS(state, IP),
1307
1308         TP_STRUCT__entry(
1309                 __field(const struct extent_state *, state)
1310                 __field(unsigned long, ip)
1311         ),
1312
1313         TP_fast_assign(
1314                 __entry->state  = state,
1315                 __entry->ip = IP
1316         ),
1317
1318         TP_printk("state=%p caller=%pS", __entry->state,
1319                   (const void *)__entry->ip)
1320 );
1321
1322 DECLARE_EVENT_CLASS(btrfs__work,
1323
1324         TP_PROTO(const struct btrfs_work *work),
1325
1326         TP_ARGS(work),
1327
1328         TP_STRUCT__entry_btrfs(
1329                 __field(        const void *,   work                    )
1330                 __field(        const void *,   wq                      )
1331                 __field(        const void *,   func                    )
1332                 __field(        const void *,   ordered_func            )
1333                 __field(        const void *,   ordered_free            )
1334                 __field(        const void *,   normal_work             )
1335         ),
1336
1337         TP_fast_assign_btrfs(btrfs_work_owner(work),
1338                 __entry->work           = work;
1339                 __entry->wq             = work->wq;
1340                 __entry->func           = work->func;
1341                 __entry->ordered_func   = work->ordered_func;
1342                 __entry->ordered_free   = work->ordered_free;
1343                 __entry->normal_work    = &work->normal_work;
1344         ),
1345
1346         TP_printk_btrfs("work=%p (normal_work=%p) wq=%p func=%pf ordered_func=%p "
1347                   "ordered_free=%p",
1348                   __entry->work, __entry->normal_work, __entry->wq,
1349                    __entry->func, __entry->ordered_func, __entry->ordered_free)
1350 );
1351
1352 /*
1353  * For situiations when the work is freed, we pass fs_info and a tag that that
1354  * matches address of the work structure so it can be paired with the
1355  * scheduling event.
1356  */
1357 DECLARE_EVENT_CLASS(btrfs__work__done,
1358
1359         TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag),
1360
1361         TP_ARGS(fs_info, wtag),
1362
1363         TP_STRUCT__entry_btrfs(
1364                 __field(        const void *,   wtag                    )
1365         ),
1366
1367         TP_fast_assign_btrfs(fs_info,
1368                 __entry->wtag           = wtag;
1369         ),
1370
1371         TP_printk_btrfs("work->%p", __entry->wtag)
1372 );
1373
1374 DEFINE_EVENT(btrfs__work, btrfs_work_queued,
1375
1376         TP_PROTO(const struct btrfs_work *work),
1377
1378         TP_ARGS(work)
1379 );
1380
1381 DEFINE_EVENT(btrfs__work, btrfs_work_sched,
1382
1383         TP_PROTO(const struct btrfs_work *work),
1384
1385         TP_ARGS(work)
1386 );
1387
1388 DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done,
1389
1390         TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag),
1391
1392         TP_ARGS(fs_info, wtag)
1393 );
1394
1395 DEFINE_EVENT(btrfs__work, btrfs_ordered_sched,
1396
1397         TP_PROTO(const struct btrfs_work *work),
1398
1399         TP_ARGS(work)
1400 );
1401
1402 DECLARE_EVENT_CLASS(btrfs__workqueue,
1403
1404         TP_PROTO(const struct __btrfs_workqueue *wq,
1405                  const char *name, int high),
1406
1407         TP_ARGS(wq, name, high),
1408
1409         TP_STRUCT__entry_btrfs(
1410                 __field(        const void *,   wq                      )
1411                 __string(       name,   name                    )
1412                 __field(        int ,   high                    )
1413         ),
1414
1415         TP_fast_assign_btrfs(btrfs_workqueue_owner(wq),
1416                 __entry->wq             = wq;
1417                 __assign_str(name, name);
1418                 __entry->high           = high;
1419         ),
1420
1421         TP_printk_btrfs("name=%s%s wq=%p", __get_str(name),
1422                   __print_flags(__entry->high, "",
1423                                 {(WQ_HIGHPRI),  "-high"}),
1424                   __entry->wq)
1425 );
1426
1427 DEFINE_EVENT(btrfs__workqueue, btrfs_workqueue_alloc,
1428
1429         TP_PROTO(const struct __btrfs_workqueue *wq,
1430                  const char *name, int high),
1431
1432         TP_ARGS(wq, name, high)
1433 );
1434
1435 DECLARE_EVENT_CLASS(btrfs__workqueue_done,
1436
1437         TP_PROTO(const struct __btrfs_workqueue *wq),
1438
1439         TP_ARGS(wq),
1440
1441         TP_STRUCT__entry_btrfs(
1442                 __field(        const void *,   wq              )
1443         ),
1444
1445         TP_fast_assign_btrfs(btrfs_workqueue_owner(wq),
1446                 __entry->wq             = wq;
1447         ),
1448
1449         TP_printk_btrfs("wq=%p", __entry->wq)
1450 );
1451
1452 DEFINE_EVENT(btrfs__workqueue_done, btrfs_workqueue_destroy,
1453
1454         TP_PROTO(const struct __btrfs_workqueue *wq),
1455
1456         TP_ARGS(wq)
1457 );
1458
1459 #define BTRFS_QGROUP_OPERATIONS                         \
1460         { QGROUP_RESERVE,       "reserve"       },      \
1461         { QGROUP_RELEASE,       "release"       },      \
1462         { QGROUP_FREE,          "free"          }
1463
1464 DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data,
1465
1466         TP_PROTO(const struct inode *inode, u64 start, u64 len,
1467                  u64 reserved, int op),
1468
1469         TP_ARGS(inode, start, len, reserved, op),
1470
1471         TP_STRUCT__entry_btrfs(
1472                 __field(        u64,            rootid          )
1473                 __field(        unsigned long,  ino             )
1474                 __field(        u64,            start           )
1475                 __field(        u64,            len             )
1476                 __field(        u64,            reserved        )
1477                 __field(        int,            op              )
1478         ),
1479
1480         TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
1481                 __entry->rootid         = BTRFS_I(inode)->root->objectid;
1482                 __entry->ino            = inode->i_ino;
1483                 __entry->start          = start;
1484                 __entry->len            = len;
1485                 __entry->reserved       = reserved;
1486                 __entry->op             = op;
1487         ),
1488
1489         TP_printk_btrfs("root=%llu ino=%lu start=%llu len=%llu reserved=%llu op=%s",
1490                   __entry->rootid, __entry->ino, __entry->start, __entry->len,
1491                   __entry->reserved,
1492                   __print_flags((unsigned long)__entry->op, "",
1493                                 BTRFS_QGROUP_OPERATIONS)
1494         )
1495 );
1496
1497 DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_reserve_data,
1498
1499         TP_PROTO(const struct inode *inode, u64 start, u64 len,
1500                  u64 reserved, int op),
1501
1502         TP_ARGS(inode, start, len, reserved, op)
1503 );
1504
1505 DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_release_data,
1506
1507         TP_PROTO(const struct inode *inode, u64 start, u64 len,
1508                  u64 reserved, int op),
1509
1510         TP_ARGS(inode, start, len, reserved, op)
1511 );
1512
1513 DECLARE_EVENT_CLASS(btrfs__qgroup_delayed_ref,
1514
1515         TP_PROTO(const struct btrfs_fs_info *fs_info,
1516                  u64 ref_root, u64 reserved),
1517
1518         TP_ARGS(fs_info, ref_root, reserved),
1519
1520         TP_STRUCT__entry_btrfs(
1521                 __field(        u64,            ref_root        )
1522                 __field(        u64,            reserved        )
1523         ),
1524
1525         TP_fast_assign_btrfs(fs_info,
1526                 __entry->ref_root       = ref_root;
1527                 __entry->reserved       = reserved;
1528         ),
1529
1530         TP_printk_btrfs("root=%llu reserved=%llu op=free",
1531                   __entry->ref_root, __entry->reserved)
1532 );
1533
1534 DEFINE_EVENT(btrfs__qgroup_delayed_ref, btrfs_qgroup_free_delayed_ref,
1535
1536         TP_PROTO(const struct btrfs_fs_info *fs_info,
1537                  u64 ref_root, u64 reserved),
1538
1539         TP_ARGS(fs_info, ref_root, reserved)
1540 );
1541
1542 DECLARE_EVENT_CLASS(btrfs_qgroup_extent,
1543         TP_PROTO(const struct btrfs_fs_info *fs_info,
1544                  const struct btrfs_qgroup_extent_record *rec),
1545
1546         TP_ARGS(fs_info, rec),
1547
1548         TP_STRUCT__entry_btrfs(
1549                 __field(        u64,  bytenr            )
1550                 __field(        u64,  num_bytes         )
1551         ),
1552
1553         TP_fast_assign_btrfs(fs_info,
1554                 __entry->bytenr         = rec->bytenr,
1555                 __entry->num_bytes      = rec->num_bytes;
1556         ),
1557
1558         TP_printk_btrfs("bytenr=%llu num_bytes=%llu",
1559                   (unsigned long long)__entry->bytenr,
1560                   (unsigned long long)__entry->num_bytes)
1561 );
1562
1563 DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents,
1564
1565         TP_PROTO(const struct btrfs_fs_info *fs_info,
1566                  const struct btrfs_qgroup_extent_record *rec),
1567
1568         TP_ARGS(fs_info, rec)
1569 );
1570
1571 DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_trace_extent,
1572
1573         TP_PROTO(const struct btrfs_fs_info *fs_info,
1574                  const struct btrfs_qgroup_extent_record *rec),
1575
1576         TP_ARGS(fs_info, rec)
1577 );
1578
1579 TRACE_EVENT(btrfs_qgroup_account_extent,
1580
1581         TP_PROTO(const struct btrfs_fs_info *fs_info, u64 bytenr,
1582                  u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots),
1583
1584         TP_ARGS(fs_info, bytenr, num_bytes, nr_old_roots, nr_new_roots),
1585
1586         TP_STRUCT__entry_btrfs(
1587                 __field(        u64,  bytenr                    )
1588                 __field(        u64,  num_bytes                 )
1589                 __field(        u64,  nr_old_roots              )
1590                 __field(        u64,  nr_new_roots              )
1591         ),
1592
1593         TP_fast_assign_btrfs(fs_info,
1594                 __entry->bytenr         = bytenr;
1595                 __entry->num_bytes      = num_bytes;
1596                 __entry->nr_old_roots   = nr_old_roots;
1597                 __entry->nr_new_roots   = nr_new_roots;
1598         ),
1599
1600         TP_printk_btrfs("bytenr=%llu num_bytes=%llu nr_old_roots=%llu "
1601                   "nr_new_roots=%llu",
1602                   __entry->bytenr,
1603                   __entry->num_bytes,
1604                   __entry->nr_old_roots,
1605                   __entry->nr_new_roots)
1606 );
1607
1608 TRACE_EVENT(qgroup_update_counters,
1609
1610         TP_PROTO(const struct btrfs_fs_info *fs_info, u64 qgid,
1611                  u64 cur_old_count, u64 cur_new_count),
1612
1613         TP_ARGS(fs_info, qgid, cur_old_count, cur_new_count),
1614
1615         TP_STRUCT__entry_btrfs(
1616                 __field(        u64,  qgid                      )
1617                 __field(        u64,  cur_old_count             )
1618                 __field(        u64,  cur_new_count             )
1619         ),
1620
1621         TP_fast_assign_btrfs(fs_info,
1622                 __entry->qgid           = qgid;
1623                 __entry->cur_old_count  = cur_old_count;
1624                 __entry->cur_new_count  = cur_new_count;
1625         ),
1626
1627         TP_printk_btrfs("qgid=%llu cur_old_count=%llu cur_new_count=%llu",
1628                   __entry->qgid,
1629                   __entry->cur_old_count,
1630                   __entry->cur_new_count)
1631 );
1632
1633 TRACE_EVENT(qgroup_update_reserve,
1634
1635         TP_PROTO(struct btrfs_fs_info *fs_info, struct btrfs_qgroup *qgroup,
1636                  s64 diff),
1637
1638         TP_ARGS(fs_info, qgroup, diff),
1639
1640         TP_STRUCT__entry_btrfs(
1641                 __field(        u64,    qgid                    )
1642                 __field(        u64,    cur_reserved            )
1643                 __field(        s64,    diff                    )
1644         ),
1645
1646         TP_fast_assign_btrfs(fs_info,
1647                 __entry->qgid           = qgroup->qgroupid;
1648                 __entry->cur_reserved   = qgroup->reserved;
1649                 __entry->diff           = diff;
1650         ),
1651
1652         TP_printk_btrfs("qgid=%llu cur_reserved=%llu diff=%lld",
1653                 __entry->qgid, __entry->cur_reserved, __entry->diff)
1654 );
1655
1656 TRACE_EVENT(qgroup_meta_reserve,
1657
1658         TP_PROTO(struct btrfs_root *root, s64 diff),
1659
1660         TP_ARGS(root, diff),
1661
1662         TP_STRUCT__entry_btrfs(
1663                 __field(        u64,    refroot                 )
1664                 __field(        s64,    diff                    )
1665         ),
1666
1667         TP_fast_assign_btrfs(root->fs_info,
1668                 __entry->refroot        = root->objectid;
1669                 __entry->diff           = diff;
1670         ),
1671
1672         TP_printk_btrfs("refroot=%llu(%s) diff=%lld",
1673                 show_root_type(__entry->refroot), __entry->diff)
1674 );
1675
1676 DECLARE_EVENT_CLASS(btrfs__prelim_ref,
1677         TP_PROTO(const struct btrfs_fs_info *fs_info,
1678                  const struct prelim_ref *oldref,
1679                  const struct prelim_ref *newref, u64 tree_size),
1680         TP_ARGS(fs_info, newref, oldref, tree_size),
1681
1682         TP_STRUCT__entry_btrfs(
1683                 __field(        u64,  root_id           )
1684                 __field(        u64,  objectid          )
1685                 __field(         u8,  type              )
1686                 __field(        u64,  offset            )
1687                 __field(        int,  level             )
1688                 __field(        int,  old_count         )
1689                 __field(        u64,  parent            )
1690                 __field(        u64,  bytenr            )
1691                 __field(        int,  mod_count         )
1692                 __field(        u64,  tree_size         )
1693         ),
1694
1695         TP_fast_assign_btrfs(fs_info,
1696                 __entry->root_id        = oldref->root_id;
1697                 __entry->objectid       = oldref->key_for_search.objectid;
1698                 __entry->type           = oldref->key_for_search.type;
1699                 __entry->offset         = oldref->key_for_search.offset;
1700                 __entry->level          = oldref->level;
1701                 __entry->old_count      = oldref->count;
1702                 __entry->parent         = oldref->parent;
1703                 __entry->bytenr         = oldref->wanted_disk_byte;
1704                 __entry->mod_count      = newref ? newref->count : 0;
1705                 __entry->tree_size      = tree_size;
1706         ),
1707
1708         TP_printk_btrfs("root_id=%llu key=[%llu,%u,%llu] level=%d count=[%d+%d=%d] parent=%llu wanted_disk_byte=%llu nodes=%llu",
1709                         (unsigned long long)__entry->root_id,
1710                         (unsigned long long)__entry->objectid, __entry->type,
1711                         (unsigned long long)__entry->offset, __entry->level,
1712                         __entry->old_count, __entry->mod_count,
1713                         __entry->old_count + __entry->mod_count,
1714                         (unsigned long long)__entry->parent,
1715                         (unsigned long long)__entry->bytenr,
1716                         (unsigned long long)__entry->tree_size)
1717 );
1718
1719 DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_merge,
1720         TP_PROTO(const struct btrfs_fs_info *fs_info,
1721                  const struct prelim_ref *oldref,
1722                  const struct prelim_ref *newref, u64 tree_size),
1723         TP_ARGS(fs_info, oldref, newref, tree_size)
1724 );
1725
1726 DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_insert,
1727         TP_PROTO(const struct btrfs_fs_info *fs_info,
1728                  const struct prelim_ref *oldref,
1729                  const struct prelim_ref *newref, u64 tree_size),
1730         TP_ARGS(fs_info, oldref, newref, tree_size)
1731 );
1732
1733 TRACE_EVENT(btrfs_inode_mod_outstanding_extents,
1734         TP_PROTO(struct btrfs_root *root, u64 ino, int mod),
1735
1736         TP_ARGS(root, ino, mod),
1737
1738         TP_STRUCT__entry_btrfs(
1739                 __field(        u64, root_objectid      )
1740                 __field(        u64, ino                )
1741                 __field(        int, mod                )
1742         ),
1743
1744         TP_fast_assign_btrfs(root->fs_info,
1745                 __entry->root_objectid  = root->objectid;
1746                 __entry->ino            = ino;
1747                 __entry->mod            = mod;
1748         ),
1749
1750         TP_printk_btrfs("root=%llu(%s) ino=%llu mod=%d",
1751                         show_root_type(__entry->root_objectid),
1752                         (unsigned long long)__entry->ino, __entry->mod)
1753 );
1754 #endif /* _TRACE_BTRFS_H */
1755
1756 /* This part must be outside protection */
1757 #include <trace/define_trace.h>