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