~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/trace/events/btrfs.h

Version: ~ [ linux-4.17-rc1 ] ~ [ linux-4.16.2 ] ~ [ linux-4.15.17 ] ~ [ linux-4.14.34 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.94 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.128 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.51 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.105 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.56 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.101 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.39.4 ] ~ [ linux-2.6.38.8 ] ~ [ linux-2.6.37.6 ] ~ [ linux-2.6.36.4 ] ~ [ linux-2.6.35.14 ] ~ [ linux-2.6.34.15 ] ~ [ linux-2.6.33.20 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.27.62 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp