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

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

Version: ~ [ linux-5.10-rc1 ] ~ [ linux-5.9.1 ] ~ [ linux-5.8.16 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.72 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.152 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.202 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.240 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.240 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ 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-2.6.32.71 ] ~ [ 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 #undef TRACE_SYSTEM
  2 #define TRACE_SYSTEM btrfs
  3 
  4 #if !defined(_TRACE_BTRFS_H) || defined(TRACE_HEADER_MULTI_READ)
  5 #define _TRACE_BTRFS_H
  6 
  7 #include <linux/writeback.h>
  8 #include <linux/tracepoint.h>
  9 #include <trace/events/gfpflags.h>
 10 
 11 struct btrfs_root;
 12 struct btrfs_fs_info;
 13 struct btrfs_inode;
 14 struct extent_map;
 15 struct btrfs_ordered_extent;
 16 struct btrfs_delayed_ref_node;
 17 struct btrfs_delayed_tree_ref;
 18 struct btrfs_delayed_data_ref;
 19 struct btrfs_delayed_ref_head;
 20 struct btrfs_block_group_cache;
 21 struct btrfs_free_cluster;
 22 struct map_lookup;
 23 struct extent_buffer;
 24 
 25 #define show_ref_type(type)                                             \
 26         __print_symbolic(type,                                          \
 27                 { BTRFS_TREE_BLOCK_REF_KEY,     "TREE_BLOCK_REF" },     \
 28                 { BTRFS_EXTENT_DATA_REF_KEY,    "EXTENT_DATA_REF" },    \
 29                 { BTRFS_EXTENT_REF_V0_KEY,      "EXTENT_REF_V0" },      \
 30                 { BTRFS_SHARED_BLOCK_REF_KEY,   "SHARED_BLOCK_REF" },   \
 31                 { BTRFS_SHARED_DATA_REF_KEY,    "SHARED_DATA_REF" })
 32 
 33 #define __show_root_type(obj)                                           \
 34         __print_symbolic_u64(obj,                                       \
 35                 { BTRFS_ROOT_TREE_OBJECTID,     "ROOT_TREE"     },      \
 36                 { BTRFS_EXTENT_TREE_OBJECTID,   "EXTENT_TREE"   },      \
 37                 { BTRFS_CHUNK_TREE_OBJECTID,    "CHUNK_TREE"    },      \
 38                 { BTRFS_DEV_TREE_OBJECTID,      "DEV_TREE"      },      \
 39                 { BTRFS_FS_TREE_OBJECTID,       "FS_TREE"       },      \
 40                 { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" },      \
 41                 { BTRFS_CSUM_TREE_OBJECTID,     "CSUM_TREE"     },      \
 42                 { BTRFS_TREE_LOG_OBJECTID,      "TREE_LOG"      },      \
 43                 { BTRFS_TREE_RELOC_OBJECTID,    "TREE_RELOC"    },      \
 44                 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
 45 
 46 #define show_root_type(obj)                                             \
 47         obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) ||                \
 48               (obj >= BTRFS_ROOT_TREE_OBJECTID &&                       \
 49                obj <= BTRFS_CSUM_TREE_OBJECTID)) ? __show_root_type(obj) : "-"
 50 
 51 #define BTRFS_GROUP_FLAGS       \
 52         { BTRFS_BLOCK_GROUP_DATA,       "DATA"}, \
 53         { BTRFS_BLOCK_GROUP_SYSTEM,     "SYSTEM"}, \
 54         { BTRFS_BLOCK_GROUP_METADATA,   "METADATA"}, \
 55         { BTRFS_BLOCK_GROUP_RAID0,      "RAID0"}, \
 56         { BTRFS_BLOCK_GROUP_RAID1,      "RAID1"}, \
 57         { BTRFS_BLOCK_GROUP_DUP,        "DUP"}, \
 58         { BTRFS_BLOCK_GROUP_RAID10,     "RAID10"}
 59 
 60 #define BTRFS_UUID_SIZE 16
 61 
 62 TRACE_EVENT(btrfs_transaction_commit,
 63 
 64         TP_PROTO(struct btrfs_root *root),
 65 
 66         TP_ARGS(root),
 67 
 68         TP_STRUCT__entry(
 69                 __field(        u64,  generation                )
 70                 __field(        u64,  root_objectid             )
 71         ),
 72 
 73         TP_fast_assign(
 74                 __entry->generation     = root->fs_info->generation;
 75                 __entry->root_objectid  = root->root_key.objectid;
 76         ),
 77 
 78         TP_printk("root = %llu(%s), gen = %llu",
 79                   show_root_type(__entry->root_objectid),
 80                   (unsigned long long)__entry->generation)
 81 );
 82 
 83 DECLARE_EVENT_CLASS(btrfs__inode,
 84 
 85         TP_PROTO(struct inode *inode),
 86 
 87         TP_ARGS(inode),
 88 
 89         TP_STRUCT__entry(
 90                 __field(        ino_t,  ino                     )
 91                 __field(        blkcnt_t,  blocks               )
 92                 __field(        u64,  disk_i_size               )
 93                 __field(        u64,  generation                )
 94                 __field(        u64,  last_trans                )
 95                 __field(        u64,  logged_trans              )
 96                 __field(        u64,  root_objectid             )
 97         ),
 98 
 99         TP_fast_assign(
100                 __entry->ino    = inode->i_ino;
101                 __entry->blocks = inode->i_blocks;
102                 __entry->disk_i_size  = BTRFS_I(inode)->disk_i_size;
103                 __entry->generation = BTRFS_I(inode)->generation;
104                 __entry->last_trans = BTRFS_I(inode)->last_trans;
105                 __entry->logged_trans = BTRFS_I(inode)->logged_trans;
106                 __entry->root_objectid =
107                                 BTRFS_I(inode)->root->root_key.objectid;
108         ),
109 
110         TP_printk("root = %llu(%s), gen = %llu, ino = %lu, blocks = %llu, "
111                   "disk_i_size = %llu, last_trans = %llu, logged_trans = %llu",
112                   show_root_type(__entry->root_objectid),
113                   (unsigned long long)__entry->generation,
114                   (unsigned long)__entry->ino,
115                   (unsigned long long)__entry->blocks,
116                   (unsigned long long)__entry->disk_i_size,
117                   (unsigned long long)__entry->last_trans,
118                   (unsigned long long)__entry->logged_trans)
119 );
120 
121 DEFINE_EVENT(btrfs__inode, btrfs_inode_new,
122 
123         TP_PROTO(struct inode *inode),
124 
125         TP_ARGS(inode)
126 );
127 
128 DEFINE_EVENT(btrfs__inode, btrfs_inode_request,
129 
130         TP_PROTO(struct inode *inode),
131 
132         TP_ARGS(inode)
133 );
134 
135 DEFINE_EVENT(btrfs__inode, btrfs_inode_evict,
136 
137         TP_PROTO(struct inode *inode),
138 
139         TP_ARGS(inode)
140 );
141 
142 #define __show_map_type(type)                                           \
143         __print_symbolic_u64(type,                                      \
144                 { EXTENT_MAP_LAST_BYTE, "LAST_BYTE"     },              \
145                 { EXTENT_MAP_HOLE,      "HOLE"          },              \
146                 { EXTENT_MAP_INLINE,    "INLINE"        },              \
147                 { EXTENT_MAP_DELALLOC,  "DELALLOC"      })
148 
149 #define show_map_type(type)                     \
150         type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" :  __show_map_type(type)
151 
152 #define show_map_flags(flag)                                            \
153         __print_flags(flag, "|",                                        \
154                 { EXTENT_FLAG_PINNED,           "PINNED"        },      \
155                 { EXTENT_FLAG_COMPRESSED,       "COMPRESSED"    },      \
156                 { EXTENT_FLAG_VACANCY,          "VACANCY"       },      \
157                 { EXTENT_FLAG_PREALLOC,         "PREALLOC"      })
158 
159 TRACE_EVENT(btrfs_get_extent,
160 
161         TP_PROTO(struct btrfs_root *root, struct extent_map *map),
162 
163         TP_ARGS(root, map),
164 
165         TP_STRUCT__entry(
166                 __field(        u64,  root_objectid     )
167                 __field(        u64,  start             )
168                 __field(        u64,  len               )
169                 __field(        u64,  orig_start        )
170                 __field(        u64,  block_start       )
171                 __field(        u64,  block_len         )
172                 __field(        unsigned long,  flags   )
173                 __field(        int,  refs              )
174                 __field(        unsigned int,  compress_type    )
175         ),
176 
177         TP_fast_assign(
178                 __entry->root_objectid  = root->root_key.objectid;
179                 __entry->start          = map->start;
180                 __entry->len            = map->len;
181                 __entry->orig_start     = map->orig_start;
182                 __entry->block_start    = map->block_start;
183                 __entry->block_len      = map->block_len;
184                 __entry->flags          = map->flags;
185                 __entry->refs           = atomic_read(&map->refs);
186                 __entry->compress_type  = map->compress_type;
187         ),
188 
189         TP_printk("root = %llu(%s), start = %llu, len = %llu, "
190                   "orig_start = %llu, block_start = %llu(%s), "
191                   "block_len = %llu, flags = %s, refs = %u, "
192                   "compress_type = %u",
193                   show_root_type(__entry->root_objectid),
194                   (unsigned long long)__entry->start,
195                   (unsigned long long)__entry->len,
196                   (unsigned long long)__entry->orig_start,
197                   show_map_type(__entry->block_start),
198                   (unsigned long long)__entry->block_len,
199                   show_map_flags(__entry->flags),
200                   __entry->refs, __entry->compress_type)
201 );
202 
203 #define show_ordered_flags(flags)                                       \
204         __print_symbolic(flags,                                 \
205                 { BTRFS_ORDERED_IO_DONE,        "IO_DONE"       },      \
206                 { BTRFS_ORDERED_COMPLETE,       "COMPLETE"      },      \
207                 { BTRFS_ORDERED_NOCOW,          "NOCOW"         },      \
208                 { BTRFS_ORDERED_COMPRESSED,     "COMPRESSED"    },      \
209                 { BTRFS_ORDERED_PREALLOC,       "PREALLOC"      },      \
210                 { BTRFS_ORDERED_DIRECT,         "DIRECT"        })
211 
212 DECLARE_EVENT_CLASS(btrfs__ordered_extent,
213 
214         TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
215 
216         TP_ARGS(inode, ordered),
217 
218         TP_STRUCT__entry(
219                 __field(        ino_t,  ino             )
220                 __field(        u64,  file_offset       )
221                 __field(        u64,  start             )
222                 __field(        u64,  len               )
223                 __field(        u64,  disk_len          )
224                 __field(        u64,  bytes_left        )
225                 __field(        unsigned long,  flags   )
226                 __field(        int,  compress_type     )
227                 __field(        int,  refs              )
228                 __field(        u64,  root_objectid     )
229         ),
230 
231         TP_fast_assign(
232                 __entry->ino            = inode->i_ino;
233                 __entry->file_offset    = ordered->file_offset;
234                 __entry->start          = ordered->start;
235                 __entry->len            = ordered->len;
236                 __entry->disk_len       = ordered->disk_len;
237                 __entry->bytes_left     = ordered->bytes_left;
238                 __entry->flags          = ordered->flags;
239                 __entry->compress_type  = ordered->compress_type;
240                 __entry->refs           = atomic_read(&ordered->refs);
241                 __entry->root_objectid  =
242                                 BTRFS_I(inode)->root->root_key.objectid;
243         ),
244 
245         TP_printk("root = %llu(%s), ino = %llu, file_offset = %llu, "
246                   "start = %llu, len = %llu, disk_len = %llu, "
247                   "bytes_left = %llu, flags = %s, compress_type = %d, "
248                   "refs = %d",
249                   show_root_type(__entry->root_objectid),
250                   (unsigned long long)__entry->ino,
251                   (unsigned long long)__entry->file_offset,
252                   (unsigned long long)__entry->start,
253                   (unsigned long long)__entry->len,
254                   (unsigned long long)__entry->disk_len,
255                   (unsigned long long)__entry->bytes_left,
256                   show_ordered_flags(__entry->flags),
257                   __entry->compress_type, __entry->refs)
258 );
259 
260 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add,
261 
262         TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
263 
264         TP_ARGS(inode, ordered)
265 );
266 
267 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove,
268 
269         TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
270 
271         TP_ARGS(inode, ordered)
272 );
273 
274 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start,
275 
276         TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
277 
278         TP_ARGS(inode, ordered)
279 );
280 
281 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put,
282 
283         TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
284 
285         TP_ARGS(inode, ordered)
286 );
287 
288 DECLARE_EVENT_CLASS(btrfs__writepage,
289 
290         TP_PROTO(struct page *page, struct inode *inode,
291                  struct writeback_control *wbc),
292 
293         TP_ARGS(page, inode, wbc),
294 
295         TP_STRUCT__entry(
296                 __field(        ino_t,  ino                     )
297                 __field(        pgoff_t,  index                 )
298                 __field(        long,   nr_to_write             )
299                 __field(        long,   pages_skipped           )
300                 __field(        loff_t, range_start             )
301                 __field(        loff_t, range_end               )
302                 __field(        char,   for_kupdate             )
303                 __field(        char,   for_reclaim             )
304                 __field(        char,   range_cyclic            )
305                 __field(        pgoff_t,  writeback_index       )
306                 __field(        u64,    root_objectid           )
307         ),
308 
309         TP_fast_assign(
310                 __entry->ino            = inode->i_ino;
311                 __entry->index          = page->index;
312                 __entry->nr_to_write    = wbc->nr_to_write;
313                 __entry->pages_skipped  = wbc->pages_skipped;
314                 __entry->range_start    = wbc->range_start;
315                 __entry->range_end      = wbc->range_end;
316                 __entry->for_kupdate    = wbc->for_kupdate;
317                 __entry->for_reclaim    = wbc->for_reclaim;
318                 __entry->range_cyclic   = wbc->range_cyclic;
319                 __entry->writeback_index = inode->i_mapping->writeback_index;
320                 __entry->root_objectid  =
321                                  BTRFS_I(inode)->root->root_key.objectid;
322         ),
323 
324         TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, "
325                   "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, "
326                   "range_end = %llu, for_kupdate = %d, "
327                   "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu",
328                   show_root_type(__entry->root_objectid),
329                   (unsigned long)__entry->ino, __entry->index,
330                   __entry->nr_to_write, __entry->pages_skipped,
331                   __entry->range_start, __entry->range_end,
332                   __entry->for_kupdate,
333                   __entry->for_reclaim, __entry->range_cyclic,
334                   (unsigned long)__entry->writeback_index)
335 );
336 
337 DEFINE_EVENT(btrfs__writepage, __extent_writepage,
338 
339         TP_PROTO(struct page *page, struct inode *inode,
340                  struct writeback_control *wbc),
341 
342         TP_ARGS(page, inode, wbc)
343 );
344 
345 TRACE_EVENT(btrfs_writepage_end_io_hook,
346 
347         TP_PROTO(struct page *page, u64 start, u64 end, int uptodate),
348 
349         TP_ARGS(page, start, end, uptodate),
350 
351         TP_STRUCT__entry(
352                 __field(        ino_t,   ino            )
353                 __field(        pgoff_t, index          )
354                 __field(        u64,     start          )
355                 __field(        u64,     end            )
356                 __field(        int,     uptodate       )
357                 __field(        u64,    root_objectid   )
358         ),
359 
360         TP_fast_assign(
361                 __entry->ino    = page->mapping->host->i_ino;
362                 __entry->index  = page->index;
363                 __entry->start  = start;
364                 __entry->end    = end;
365                 __entry->uptodate = uptodate;
366                 __entry->root_objectid  =
367                          BTRFS_I(page->mapping->host)->root->root_key.objectid;
368         ),
369 
370         TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, "
371                   "end = %llu, uptodate = %d",
372                   show_root_type(__entry->root_objectid),
373                   (unsigned long)__entry->ino, (unsigned long)__entry->index,
374                   (unsigned long long)__entry->start,
375                   (unsigned long long)__entry->end, __entry->uptodate)
376 );
377 
378 TRACE_EVENT(btrfs_sync_file,
379 
380         TP_PROTO(struct file *file, int datasync),
381 
382         TP_ARGS(file, datasync),
383 
384         TP_STRUCT__entry(
385                 __field(        ino_t,  ino             )
386                 __field(        ino_t,  parent          )
387                 __field(        int,    datasync        )
388                 __field(        u64,    root_objectid   )
389         ),
390 
391         TP_fast_assign(
392                 struct dentry *dentry = file->f_path.dentry;
393                 struct inode *inode = dentry->d_inode;
394 
395                 __entry->ino            = inode->i_ino;
396                 __entry->parent         = dentry->d_parent->d_inode->i_ino;
397                 __entry->datasync       = datasync;
398                 __entry->root_objectid  =
399                                  BTRFS_I(inode)->root->root_key.objectid;
400         ),
401 
402         TP_printk("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d",
403                   show_root_type(__entry->root_objectid),
404                   (unsigned long)__entry->ino, (unsigned long)__entry->parent,
405                   __entry->datasync)
406 );
407 
408 TRACE_EVENT(btrfs_sync_fs,
409 
410         TP_PROTO(int wait),
411 
412         TP_ARGS(wait),
413 
414         TP_STRUCT__entry(
415                 __field(        int,  wait              )
416         ),
417 
418         TP_fast_assign(
419                 __entry->wait   = wait;
420         ),
421 
422         TP_printk("wait = %d", __entry->wait)
423 );
424 
425 #define show_ref_action(action)                                         \
426         __print_symbolic(action,                                        \
427                 { BTRFS_ADD_DELAYED_REF,    "ADD_DELAYED_REF" },        \
428                 { BTRFS_DROP_DELAYED_REF,   "DROP_DELAYED_REF" },       \
429                 { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" },     \
430                 { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" })
431                         
432 
433 TRACE_EVENT(btrfs_delayed_tree_ref,
434 
435         TP_PROTO(struct btrfs_delayed_ref_node *ref,
436                  struct btrfs_delayed_tree_ref *full_ref,
437                  int action),
438 
439         TP_ARGS(ref, full_ref, action),
440 
441         TP_STRUCT__entry(
442                 __field(        u64,  bytenr            )
443                 __field(        u64,  num_bytes         )
444                 __field(        int,  action            ) 
445                 __field(        u64,  parent            )
446                 __field(        u64,  ref_root          )
447                 __field(        int,  level             )
448                 __field(        int,  type              )
449                 __field(        u64,  seq               )
450         ),
451 
452         TP_fast_assign(
453                 __entry->bytenr         = ref->bytenr;
454                 __entry->num_bytes      = ref->num_bytes;
455                 __entry->action         = action;
456                 __entry->parent         = full_ref->parent;
457                 __entry->ref_root       = full_ref->root;
458                 __entry->level          = full_ref->level;
459                 __entry->type           = ref->type;
460                 __entry->seq            = ref->seq;
461         ),
462 
463         TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
464                   "parent = %llu(%s), ref_root = %llu(%s), level = %d, "
465                   "type = %s, seq = %llu",
466                   (unsigned long long)__entry->bytenr,
467                   (unsigned long long)__entry->num_bytes,
468                   show_ref_action(__entry->action),
469                   show_root_type(__entry->parent),
470                   show_root_type(__entry->ref_root),
471                   __entry->level, show_ref_type(__entry->type),
472                   (unsigned long long)__entry->seq)
473 );
474 
475 TRACE_EVENT(btrfs_delayed_data_ref,
476 
477         TP_PROTO(struct btrfs_delayed_ref_node *ref,
478                  struct btrfs_delayed_data_ref *full_ref,
479                  int action),
480 
481         TP_ARGS(ref, full_ref, action),
482 
483         TP_STRUCT__entry(
484                 __field(        u64,  bytenr            )
485                 __field(        u64,  num_bytes         )
486                 __field(        int,  action            ) 
487                 __field(        u64,  parent            )
488                 __field(        u64,  ref_root          )
489                 __field(        u64,  owner             )
490                 __field(        u64,  offset            )
491                 __field(        int,  type              )
492                 __field(        u64,  seq               )
493         ),
494 
495         TP_fast_assign(
496                 __entry->bytenr         = ref->bytenr;
497                 __entry->num_bytes      = ref->num_bytes;
498                 __entry->action         = action;
499                 __entry->parent         = full_ref->parent;
500                 __entry->ref_root       = full_ref->root;
501                 __entry->owner          = full_ref->objectid;
502                 __entry->offset         = full_ref->offset;
503                 __entry->type           = ref->type;
504                 __entry->seq            = ref->seq;
505         ),
506 
507         TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
508                   "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, "
509                   "offset = %llu, type = %s, seq = %llu",
510                   (unsigned long long)__entry->bytenr,
511                   (unsigned long long)__entry->num_bytes,
512                   show_ref_action(__entry->action),
513                   show_root_type(__entry->parent),
514                   show_root_type(__entry->ref_root),
515                   (unsigned long long)__entry->owner,
516                   (unsigned long long)__entry->offset,
517                   show_ref_type(__entry->type),
518                   (unsigned long long)__entry->seq)
519 );
520 
521 TRACE_EVENT(btrfs_delayed_ref_head,
522 
523         TP_PROTO(struct btrfs_delayed_ref_node *ref,
524                  struct btrfs_delayed_ref_head *head_ref,
525                  int action),
526 
527         TP_ARGS(ref, head_ref, action),
528 
529         TP_STRUCT__entry(
530                 __field(        u64,  bytenr            )
531                 __field(        u64,  num_bytes         )
532                 __field(        int,  action            ) 
533                 __field(        int,  is_data           )
534         ),
535 
536         TP_fast_assign(
537                 __entry->bytenr         = ref->bytenr;
538                 __entry->num_bytes      = ref->num_bytes;
539                 __entry->action         = action;
540                 __entry->is_data        = head_ref->is_data;
541         ),
542 
543         TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d",
544                   (unsigned long long)__entry->bytenr,
545                   (unsigned long long)__entry->num_bytes,
546                   show_ref_action(__entry->action),
547                   __entry->is_data)
548 );
549 
550 #define show_chunk_type(type)                                   \
551         __print_flags(type, "|",                                \
552                 { BTRFS_BLOCK_GROUP_DATA,       "DATA"  },      \
553                 { BTRFS_BLOCK_GROUP_SYSTEM,     "SYSTEM"},      \
554                 { BTRFS_BLOCK_GROUP_METADATA,   "METADATA"},    \
555                 { BTRFS_BLOCK_GROUP_RAID0,      "RAID0" },      \
556                 { BTRFS_BLOCK_GROUP_RAID1,      "RAID1" },      \
557                 { BTRFS_BLOCK_GROUP_DUP,        "DUP"   },      \
558                 { BTRFS_BLOCK_GROUP_RAID10,     "RAID10"})
559 
560 DECLARE_EVENT_CLASS(btrfs__chunk,
561 
562         TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
563                  u64 offset, u64 size),
564 
565         TP_ARGS(root, map, offset, size),
566 
567         TP_STRUCT__entry(
568                 __field(        int,  num_stripes               )
569                 __field(        u64,  type                      )
570                 __field(        int,  sub_stripes               )
571                 __field(        u64,  offset                    )
572                 __field(        u64,  size                      )
573                 __field(        u64,  root_objectid             )
574         ),
575 
576         TP_fast_assign(
577                 __entry->num_stripes    = map->num_stripes;
578                 __entry->type           = map->type;
579                 __entry->sub_stripes    = map->sub_stripes;
580                 __entry->offset         = offset;
581                 __entry->size           = size;
582                 __entry->root_objectid  = root->root_key.objectid;
583         ),
584 
585         TP_printk("root = %llu(%s), offset = %llu, size = %llu, "
586                   "num_stripes = %d, sub_stripes = %d, type = %s",
587                   show_root_type(__entry->root_objectid),
588                   (unsigned long long)__entry->offset,
589                   (unsigned long long)__entry->size,
590                   __entry->num_stripes, __entry->sub_stripes,
591                   show_chunk_type(__entry->type))
592 );
593 
594 DEFINE_EVENT(btrfs__chunk,  btrfs_chunk_alloc,
595 
596         TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
597                  u64 offset, u64 size),
598 
599         TP_ARGS(root, map, offset, size)
600 );
601 
602 DEFINE_EVENT(btrfs__chunk,  btrfs_chunk_free,
603 
604         TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
605                  u64 offset, u64 size),
606 
607         TP_ARGS(root, map, offset, size)
608 );
609 
610 TRACE_EVENT(btrfs_cow_block,
611 
612         TP_PROTO(struct btrfs_root *root, struct extent_buffer *buf,
613                  struct extent_buffer *cow),
614 
615         TP_ARGS(root, buf, cow),
616 
617         TP_STRUCT__entry(
618                 __field(        u64,  root_objectid             )
619                 __field(        u64,  buf_start                 )
620                 __field(        int,  refs                      )
621                 __field(        u64,  cow_start                 )
622                 __field(        int,  buf_level                 )
623                 __field(        int,  cow_level                 )
624         ),
625 
626         TP_fast_assign(
627                 __entry->root_objectid  = root->root_key.objectid;
628                 __entry->buf_start      = buf->start;
629                 __entry->refs           = atomic_read(&buf->refs);
630                 __entry->cow_start      = cow->start;
631                 __entry->buf_level      = btrfs_header_level(buf);
632                 __entry->cow_level      = btrfs_header_level(cow);
633         ),
634 
635         TP_printk("root = %llu(%s), refs = %d, orig_buf = %llu "
636                   "(orig_level = %d), cow_buf = %llu (cow_level = %d)",
637                   show_root_type(__entry->root_objectid),
638                   __entry->refs,
639                   (unsigned long long)__entry->buf_start,
640                   __entry->buf_level,
641                   (unsigned long long)__entry->cow_start,
642                   __entry->cow_level)
643 );
644 
645 TRACE_EVENT(btrfs_space_reservation,
646 
647         TP_PROTO(struct btrfs_fs_info *fs_info, char *type, u64 val,
648                  u64 bytes, int reserve),
649 
650         TP_ARGS(fs_info, type, val, bytes, reserve),
651 
652         TP_STRUCT__entry(
653                 __array(        u8,     fsid,   BTRFS_UUID_SIZE )
654                 __string(       type,   type                    )
655                 __field(        u64,    val                     )
656                 __field(        u64,    bytes                   )
657                 __field(        int,    reserve                 )
658         ),
659 
660         TP_fast_assign(
661                 memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE);
662                 __assign_str(type, type);
663                 __entry->val            = val;
664                 __entry->bytes          = bytes;
665                 __entry->reserve        = reserve;
666         ),
667 
668         TP_printk("%pU: %s: %Lu %s %Lu", __entry->fsid, __get_str(type),
669                   __entry->val, __entry->reserve ? "reserve" : "release",
670                   __entry->bytes)
671 );
672 
673 DECLARE_EVENT_CLASS(btrfs__reserved_extent,
674 
675         TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
676 
677         TP_ARGS(root, start, len),
678 
679         TP_STRUCT__entry(
680                 __field(        u64,  root_objectid             )
681                 __field(        u64,  start                     )
682                 __field(        u64,  len                       )
683         ),
684 
685         TP_fast_assign(
686                 __entry->root_objectid  = root->root_key.objectid;
687                 __entry->start          = start;
688                 __entry->len            = len;
689         ),
690 
691         TP_printk("root = %llu(%s), start = %llu, len = %llu",
692                   show_root_type(__entry->root_objectid),
693                   (unsigned long long)__entry->start,
694                   (unsigned long long)__entry->len)
695 );
696 
697 DEFINE_EVENT(btrfs__reserved_extent,  btrfs_reserved_extent_alloc,
698 
699         TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
700 
701         TP_ARGS(root, start, len)
702 );
703 
704 DEFINE_EVENT(btrfs__reserved_extent,  btrfs_reserved_extent_free,
705 
706         TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
707 
708         TP_ARGS(root, start, len)
709 );
710 
711 TRACE_EVENT(find_free_extent,
712 
713         TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size,
714                  u64 data),
715 
716         TP_ARGS(root, num_bytes, empty_size, data),
717 
718         TP_STRUCT__entry(
719                 __field(        u64,    root_objectid           )
720                 __field(        u64,    num_bytes               )
721                 __field(        u64,    empty_size              )
722                 __field(        u64,    data                    )
723         ),
724 
725         TP_fast_assign(
726                 __entry->root_objectid  = root->root_key.objectid;
727                 __entry->num_bytes      = num_bytes;
728                 __entry->empty_size     = empty_size;
729                 __entry->data           = data;
730         ),
731 
732         TP_printk("root = %Lu(%s), len = %Lu, empty_size = %Lu, "
733                   "flags = %Lu(%s)", show_root_type(__entry->root_objectid),
734                   __entry->num_bytes, __entry->empty_size, __entry->data,
735                   __print_flags((unsigned long)__entry->data, "|",
736                                  BTRFS_GROUP_FLAGS))
737 );
738 
739 DECLARE_EVENT_CLASS(btrfs__reserve_extent,
740 
741         TP_PROTO(struct btrfs_root *root,
742                  struct btrfs_block_group_cache *block_group, u64 start,
743                  u64 len),
744 
745         TP_ARGS(root, block_group, start, len),
746 
747         TP_STRUCT__entry(
748                 __field(        u64,    root_objectid           )
749                 __field(        u64,    bg_objectid             )
750                 __field(        u64,    flags                   )
751                 __field(        u64,    start                   )
752                 __field(        u64,    len                     )
753         ),
754 
755         TP_fast_assign(
756                 __entry->root_objectid  = root->root_key.objectid;
757                 __entry->bg_objectid    = block_group->key.objectid;
758                 __entry->flags          = block_group->flags;
759                 __entry->start          = start;
760                 __entry->len            = len;
761         ),
762 
763         TP_printk("root = %Lu(%s), block_group = %Lu, flags = %Lu(%s), "
764                   "start = %Lu, len = %Lu",
765                   show_root_type(__entry->root_objectid), __entry->bg_objectid,
766                   __entry->flags, __print_flags((unsigned long)__entry->flags,
767                                                 "|", BTRFS_GROUP_FLAGS),
768                   __entry->start, __entry->len)
769 );
770 
771 DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent,
772 
773         TP_PROTO(struct btrfs_root *root,
774                  struct btrfs_block_group_cache *block_group, u64 start,
775                  u64 len),
776 
777         TP_ARGS(root, block_group, start, len)
778 );
779 
780 DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster,
781 
782         TP_PROTO(struct btrfs_root *root,
783                  struct btrfs_block_group_cache *block_group, u64 start,
784                  u64 len),
785 
786         TP_ARGS(root, block_group, start, len)
787 );
788 
789 TRACE_EVENT(btrfs_find_cluster,
790 
791         TP_PROTO(struct btrfs_block_group_cache *block_group, u64 start,
792                  u64 bytes, u64 empty_size, u64 min_bytes),
793 
794         TP_ARGS(block_group, start, bytes, empty_size, min_bytes),
795 
796         TP_STRUCT__entry(
797                 __field(        u64,    bg_objectid             )
798                 __field(        u64,    flags                   )
799                 __field(        u64,    start                   )
800                 __field(        u64,    bytes                   )
801                 __field(        u64,    empty_size              )
802                 __field(        u64,    min_bytes               )
803         ),
804 
805         TP_fast_assign(
806                 __entry->bg_objectid    = block_group->key.objectid;
807                 __entry->flags          = block_group->flags;
808                 __entry->start          = start;
809                 __entry->bytes          = bytes;
810                 __entry->empty_size     = empty_size;
811                 __entry->min_bytes      = min_bytes;
812         ),
813 
814         TP_printk("block_group = %Lu, flags = %Lu(%s), start = %Lu, len = %Lu,"
815                   " empty_size = %Lu, min_bytes = %Lu", __entry->bg_objectid,
816                   __entry->flags,
817                   __print_flags((unsigned long)__entry->flags, "|",
818                                 BTRFS_GROUP_FLAGS), __entry->start,
819                   __entry->bytes, __entry->empty_size,  __entry->min_bytes)
820 );
821 
822 TRACE_EVENT(btrfs_failed_cluster_setup,
823 
824         TP_PROTO(struct btrfs_block_group_cache *block_group),
825 
826         TP_ARGS(block_group),
827 
828         TP_STRUCT__entry(
829                 __field(        u64,    bg_objectid             )
830         ),
831 
832         TP_fast_assign(
833                 __entry->bg_objectid    = block_group->key.objectid;
834         ),
835 
836         TP_printk("block_group = %Lu", __entry->bg_objectid)
837 );
838 
839 TRACE_EVENT(btrfs_setup_cluster,
840 
841         TP_PROTO(struct btrfs_block_group_cache *block_group,
842                  struct btrfs_free_cluster *cluster, u64 size, int bitmap),
843 
844         TP_ARGS(block_group, cluster, size, bitmap),
845 
846         TP_STRUCT__entry(
847                 __field(        u64,    bg_objectid             )
848                 __field(        u64,    flags                   )
849                 __field(        u64,    start                   )
850                 __field(        u64,    max_size                )
851                 __field(        u64,    size                    )
852                 __field(        int,    bitmap                  )
853         ),
854 
855         TP_fast_assign(
856                 __entry->bg_objectid    = block_group->key.objectid;
857                 __entry->flags          = block_group->flags;
858                 __entry->start          = cluster->window_start;
859                 __entry->max_size       = cluster->max_size;
860                 __entry->size           = size;
861                 __entry->bitmap         = bitmap;
862         ),
863 
864         TP_printk("block_group = %Lu, flags = %Lu(%s), window_start = %Lu, "
865                   "size = %Lu, max_size = %Lu, bitmap = %d",
866                   __entry->bg_objectid,
867                   __entry->flags,
868                   __print_flags((unsigned long)__entry->flags, "|",
869                                 BTRFS_GROUP_FLAGS), __entry->start,
870                   __entry->size, __entry->max_size, __entry->bitmap)
871 );
872 
873 struct extent_state;
874 TRACE_EVENT(alloc_extent_state,
875 
876         TP_PROTO(struct extent_state *state, gfp_t mask, unsigned long IP),
877 
878         TP_ARGS(state, mask, IP),
879 
880         TP_STRUCT__entry(
881                 __field(struct extent_state *, state)
882                 __field(gfp_t, mask)
883                 __field(unsigned long, ip)
884         ),
885 
886         TP_fast_assign(
887                 __entry->state  = state,
888                 __entry->mask   = mask,
889                 __entry->ip     = IP
890         ),
891 
892         TP_printk("state=%p; mask = %s; caller = %pF", __entry->state,
893                   show_gfp_flags(__entry->mask), (void *)__entry->ip)
894 );
895 
896 TRACE_EVENT(free_extent_state,
897 
898         TP_PROTO(struct extent_state *state, unsigned long IP),
899 
900         TP_ARGS(state, IP),
901 
902         TP_STRUCT__entry(
903                 __field(struct extent_state *, state)
904                 __field(unsigned long, ip)
905         ),
906 
907         TP_fast_assign(
908                 __entry->state  = state,
909                 __entry->ip = IP
910         ),
911 
912         TP_printk(" state=%p; caller = %pF", __entry->state,
913                   (void *)__entry->ip)
914 );
915 
916 #endif /* _TRACE_BTRFS_H */
917 
918 /* This part must be outside protection */
919 #include <trace/define_trace.h>
920 

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