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

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

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

~ [ 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