]> git.sesse.net Git - bcachefs-tools-debian/blob - include/trace/events/bcachefs.h
New upstream snapshot
[bcachefs-tools-debian] / include / trace / events / bcachefs.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM bcachefs
4
5 #if !defined(_TRACE_BCACHE_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_BCACHE_H
7
8 #include <linux/tracepoint.h>
9
10 DECLARE_EVENT_CLASS(bpos,
11         TP_PROTO(struct bpos *p),
12         TP_ARGS(p),
13
14         TP_STRUCT__entry(
15                 __field(u64,    inode                           )
16                 __field(u64,    offset                          )
17         ),
18
19         TP_fast_assign(
20                 __entry->inode  = p->inode;
21                 __entry->offset = p->offset;
22         ),
23
24         TP_printk("%llu:%llu", __entry->inode, __entry->offset)
25 );
26
27 DECLARE_EVENT_CLASS(bkey,
28         TP_PROTO(const struct bkey *k),
29         TP_ARGS(k),
30
31         TP_STRUCT__entry(
32                 __field(u64,    inode                           )
33                 __field(u64,    offset                          )
34                 __field(u32,    size                            )
35         ),
36
37         TP_fast_assign(
38                 __entry->inode  = k->p.inode;
39                 __entry->offset = k->p.offset;
40                 __entry->size   = k->size;
41         ),
42
43         TP_printk("%llu:%llu len %u", __entry->inode,
44                   __entry->offset, __entry->size)
45 );
46
47 DECLARE_EVENT_CLASS(bch_fs,
48         TP_PROTO(struct bch_fs *c),
49         TP_ARGS(c),
50
51         TP_STRUCT__entry(
52                 __array(char,           uuid,   16 )
53         ),
54
55         TP_fast_assign(
56                 memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
57         ),
58
59         TP_printk("%pU", __entry->uuid)
60 );
61
62 DECLARE_EVENT_CLASS(bio,
63         TP_PROTO(struct bio *bio),
64         TP_ARGS(bio),
65
66         TP_STRUCT__entry(
67                 __field(dev_t,          dev                     )
68                 __field(sector_t,       sector                  )
69                 __field(unsigned int,   nr_sector               )
70                 __array(char,           rwbs,   6               )
71         ),
72
73         TP_fast_assign(
74                 __entry->dev            = bio->bi_disk ? bio_dev(bio) : 0;
75                 __entry->sector         = bio->bi_iter.bi_sector;
76                 __entry->nr_sector      = bio->bi_iter.bi_size >> 9;
77                 blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
78         ),
79
80         TP_printk("%d,%d  %s %llu + %u",
81                   MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
82                   (unsigned long long)__entry->sector, __entry->nr_sector)
83 );
84
85 /* io.c: */
86
87 DEFINE_EVENT(bio, read_split,
88         TP_PROTO(struct bio *bio),
89         TP_ARGS(bio)
90 );
91
92 DEFINE_EVENT(bio, read_bounce,
93         TP_PROTO(struct bio *bio),
94         TP_ARGS(bio)
95 );
96
97 DEFINE_EVENT(bio, read_retry,
98         TP_PROTO(struct bio *bio),
99         TP_ARGS(bio)
100 );
101
102 DEFINE_EVENT(bio, promote,
103         TP_PROTO(struct bio *bio),
104         TP_ARGS(bio)
105 );
106
107 /* Journal */
108
109 DEFINE_EVENT(bch_fs, journal_full,
110         TP_PROTO(struct bch_fs *c),
111         TP_ARGS(c)
112 );
113
114 DEFINE_EVENT(bch_fs, journal_entry_full,
115         TP_PROTO(struct bch_fs *c),
116         TP_ARGS(c)
117 );
118
119 DEFINE_EVENT(bio, journal_write,
120         TP_PROTO(struct bio *bio),
121         TP_ARGS(bio)
122 );
123
124 TRACE_EVENT(journal_reclaim_start,
125         TP_PROTO(struct bch_fs *c, u64 min_nr,
126                  u64 prereserved, u64 prereserved_total,
127                  u64 btree_cache_dirty, u64 btree_cache_total,
128                  u64 btree_key_cache_dirty, u64 btree_key_cache_total),
129         TP_ARGS(c, min_nr, prereserved, prereserved_total,
130                 btree_cache_dirty, btree_cache_total,
131                 btree_key_cache_dirty, btree_key_cache_total),
132
133         TP_STRUCT__entry(
134                 __array(char,           uuid,   16              )
135                 __field(u64,            min_nr                  )
136                 __field(u64,            prereserved             )
137                 __field(u64,            prereserved_total       )
138                 __field(u64,            btree_cache_dirty       )
139                 __field(u64,            btree_cache_total       )
140                 __field(u64,            btree_key_cache_dirty   )
141                 __field(u64,            btree_key_cache_total   )
142         ),
143
144         TP_fast_assign(
145                 memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
146                 __entry->min_nr                 = min_nr;
147                 __entry->prereserved            = prereserved;
148                 __entry->prereserved_total      = prereserved_total;
149                 __entry->btree_cache_dirty      = btree_cache_dirty;
150                 __entry->btree_cache_total      = btree_cache_total;
151                 __entry->btree_key_cache_dirty  = btree_key_cache_dirty;
152                 __entry->btree_key_cache_total  = btree_key_cache_total;
153         ),
154
155         TP_printk("%pU min %llu prereserved %llu/%llu btree cache %llu/%llu key cache %llu/%llu",
156                   __entry->uuid,
157                   __entry->min_nr,
158                   __entry->prereserved,
159                   __entry->prereserved_total,
160                   __entry->btree_cache_dirty,
161                   __entry->btree_cache_total,
162                   __entry->btree_key_cache_dirty,
163                   __entry->btree_key_cache_total)
164 );
165
166 TRACE_EVENT(journal_reclaim_finish,
167         TP_PROTO(struct bch_fs *c, u64 nr_flushed),
168         TP_ARGS(c, nr_flushed),
169
170         TP_STRUCT__entry(
171                 __array(char,           uuid,   16 )
172                 __field(u64,            nr_flushed )
173         ),
174
175         TP_fast_assign(
176                 memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
177                 __entry->nr_flushed = nr_flushed;
178         ),
179
180         TP_printk("%pU flushed %llu", __entry->uuid, __entry->nr_flushed)
181 );
182
183 /* bset.c: */
184
185 DEFINE_EVENT(bpos, bkey_pack_pos_fail,
186         TP_PROTO(struct bpos *p),
187         TP_ARGS(p)
188 );
189
190 /* Btree */
191
192 DECLARE_EVENT_CLASS(btree_node,
193         TP_PROTO(struct bch_fs *c, struct btree *b),
194         TP_ARGS(c, b),
195
196         TP_STRUCT__entry(
197                 __array(char,           uuid,           16      )
198                 __field(u8,             level                   )
199                 __field(u8,             id                      )
200                 __field(u64,            inode                   )
201                 __field(u64,            offset                  )
202         ),
203
204         TP_fast_assign(
205                 memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
206                 __entry->level          = b->c.level;
207                 __entry->id             = b->c.btree_id;
208                 __entry->inode          = b->key.k.p.inode;
209                 __entry->offset         = b->key.k.p.offset;
210         ),
211
212         TP_printk("%pU  %u id %u %llu:%llu",
213                   __entry->uuid, __entry->level, __entry->id,
214                   __entry->inode, __entry->offset)
215 );
216
217 DEFINE_EVENT(btree_node, btree_read,
218         TP_PROTO(struct bch_fs *c, struct btree *b),
219         TP_ARGS(c, b)
220 );
221
222 TRACE_EVENT(btree_write,
223         TP_PROTO(struct btree *b, unsigned bytes, unsigned sectors),
224         TP_ARGS(b, bytes, sectors),
225
226         TP_STRUCT__entry(
227                 __field(enum btree_node_type,   type)
228                 __field(unsigned,       bytes                   )
229                 __field(unsigned,       sectors                 )
230         ),
231
232         TP_fast_assign(
233                 __entry->type   = btree_node_type(b);
234                 __entry->bytes  = bytes;
235                 __entry->sectors = sectors;
236         ),
237
238         TP_printk("bkey type %u bytes %u sectors %u",
239                   __entry->type , __entry->bytes, __entry->sectors)
240 );
241
242 DEFINE_EVENT(btree_node, btree_node_alloc,
243         TP_PROTO(struct bch_fs *c, struct btree *b),
244         TP_ARGS(c, b)
245 );
246
247 DEFINE_EVENT(btree_node, btree_node_free,
248         TP_PROTO(struct bch_fs *c, struct btree *b),
249         TP_ARGS(c, b)
250 );
251
252 DEFINE_EVENT(btree_node, btree_node_reap,
253         TP_PROTO(struct bch_fs *c, struct btree *b),
254         TP_ARGS(c, b)
255 );
256
257 DECLARE_EVENT_CLASS(btree_node_cannibalize_lock,
258         TP_PROTO(struct bch_fs *c),
259         TP_ARGS(c),
260
261         TP_STRUCT__entry(
262                 __array(char,                   uuid,   16      )
263         ),
264
265         TP_fast_assign(
266                 memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
267         ),
268
269         TP_printk("%pU", __entry->uuid)
270 );
271
272 DEFINE_EVENT(btree_node_cannibalize_lock, btree_node_cannibalize_lock_fail,
273         TP_PROTO(struct bch_fs *c),
274         TP_ARGS(c)
275 );
276
277 DEFINE_EVENT(btree_node_cannibalize_lock, btree_node_cannibalize_lock,
278         TP_PROTO(struct bch_fs *c),
279         TP_ARGS(c)
280 );
281
282 DEFINE_EVENT(btree_node_cannibalize_lock, btree_node_cannibalize,
283         TP_PROTO(struct bch_fs *c),
284         TP_ARGS(c)
285 );
286
287 DEFINE_EVENT(bch_fs, btree_node_cannibalize_unlock,
288         TP_PROTO(struct bch_fs *c),
289         TP_ARGS(c)
290 );
291
292 TRACE_EVENT(btree_reserve_get_fail,
293         TP_PROTO(struct bch_fs *c, size_t required, struct closure *cl),
294         TP_ARGS(c, required, cl),
295
296         TP_STRUCT__entry(
297                 __array(char,                   uuid,   16      )
298                 __field(size_t,                 required        )
299                 __field(struct closure *,       cl              )
300         ),
301
302         TP_fast_assign(
303                 memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
304                 __entry->required = required;
305                 __entry->cl = cl;
306         ),
307
308         TP_printk("%pU required %zu by %p", __entry->uuid,
309                   __entry->required, __entry->cl)
310 );
311
312 TRACE_EVENT(btree_insert_key,
313         TP_PROTO(struct bch_fs *c, struct btree *b, struct bkey_i *k),
314         TP_ARGS(c, b, k),
315
316         TP_STRUCT__entry(
317                 __field(u8,             id                      )
318                 __field(u64,            inode                   )
319                 __field(u64,            offset                  )
320                 __field(u32,            size                    )
321         ),
322
323         TP_fast_assign(
324                 __entry->id             = b->c.btree_id;
325                 __entry->inode          = k->k.p.inode;
326                 __entry->offset         = k->k.p.offset;
327                 __entry->size           = k->k.size;
328         ),
329
330         TP_printk("btree %u: %llu:%llu len %u", __entry->id,
331                   __entry->inode, __entry->offset, __entry->size)
332 );
333
334 DEFINE_EVENT(btree_node, btree_split,
335         TP_PROTO(struct bch_fs *c, struct btree *b),
336         TP_ARGS(c, b)
337 );
338
339 DEFINE_EVENT(btree_node, btree_compact,
340         TP_PROTO(struct bch_fs *c, struct btree *b),
341         TP_ARGS(c, b)
342 );
343
344 DEFINE_EVENT(btree_node, btree_merge,
345         TP_PROTO(struct bch_fs *c, struct btree *b),
346         TP_ARGS(c, b)
347 );
348
349 DEFINE_EVENT(btree_node, btree_set_root,
350         TP_PROTO(struct bch_fs *c, struct btree *b),
351         TP_ARGS(c, b)
352 );
353
354 /* Garbage collection */
355
356 DEFINE_EVENT(btree_node, btree_gc_coalesce,
357         TP_PROTO(struct bch_fs *c, struct btree *b),
358         TP_ARGS(c, b)
359 );
360
361 TRACE_EVENT(btree_gc_coalesce_fail,
362         TP_PROTO(struct bch_fs *c, int reason),
363         TP_ARGS(c, reason),
364
365         TP_STRUCT__entry(
366                 __field(u8,             reason                  )
367                 __array(char,           uuid,   16              )
368         ),
369
370         TP_fast_assign(
371                 __entry->reason         = reason;
372                 memcpy(__entry->uuid, c->disk_sb.sb->user_uuid.b, 16);
373         ),
374
375         TP_printk("%pU: %u", __entry->uuid, __entry->reason)
376 );
377
378 DEFINE_EVENT(btree_node, btree_gc_rewrite_node,
379         TP_PROTO(struct bch_fs *c, struct btree *b),
380         TP_ARGS(c, b)
381 );
382
383 DEFINE_EVENT(btree_node, btree_gc_rewrite_node_fail,
384         TP_PROTO(struct bch_fs *c, struct btree *b),
385         TP_ARGS(c, b)
386 );
387
388 DEFINE_EVENT(bch_fs, gc_start,
389         TP_PROTO(struct bch_fs *c),
390         TP_ARGS(c)
391 );
392
393 DEFINE_EVENT(bch_fs, gc_end,
394         TP_PROTO(struct bch_fs *c),
395         TP_ARGS(c)
396 );
397
398 DEFINE_EVENT(bch_fs, gc_coalesce_start,
399         TP_PROTO(struct bch_fs *c),
400         TP_ARGS(c)
401 );
402
403 DEFINE_EVENT(bch_fs, gc_coalesce_end,
404         TP_PROTO(struct bch_fs *c),
405         TP_ARGS(c)
406 );
407
408 DEFINE_EVENT(bch_fs, gc_cannot_inc_gens,
409         TP_PROTO(struct bch_fs *c),
410         TP_ARGS(c)
411 );
412
413 /* Allocator */
414
415 TRACE_EVENT(alloc_batch,
416         TP_PROTO(struct bch_dev *ca, size_t free, size_t total),
417         TP_ARGS(ca, free, total),
418
419         TP_STRUCT__entry(
420                 __array(char,           uuid,   16      )
421                 __field(size_t,         free            )
422                 __field(size_t,         total           )
423         ),
424
425         TP_fast_assign(
426                 memcpy(__entry->uuid, ca->uuid.b, 16);
427                 __entry->free = free;
428                 __entry->total = total;
429         ),
430
431         TP_printk("%pU free %zu total %zu",
432                 __entry->uuid, __entry->free, __entry->total)
433 );
434
435 TRACE_EVENT(invalidate,
436         TP_PROTO(struct bch_dev *ca, u64 offset, unsigned sectors),
437         TP_ARGS(ca, offset, sectors),
438
439         TP_STRUCT__entry(
440                 __field(unsigned,       sectors                 )
441                 __field(dev_t,          dev                     )
442                 __field(__u64,          offset                  )
443         ),
444
445         TP_fast_assign(
446                 __entry->dev            = ca->disk_sb.bdev->bd_dev;
447                 __entry->offset         = offset,
448                 __entry->sectors        = sectors;
449         ),
450
451         TP_printk("invalidated %u sectors at %d,%d sector=%llu",
452                   __entry->sectors, MAJOR(__entry->dev),
453                   MINOR(__entry->dev), __entry->offset)
454 );
455
456 DEFINE_EVENT(bch_fs, rescale_prios,
457         TP_PROTO(struct bch_fs *c),
458         TP_ARGS(c)
459 );
460
461 DECLARE_EVENT_CLASS(bucket_alloc,
462         TP_PROTO(struct bch_dev *ca, enum alloc_reserve reserve),
463         TP_ARGS(ca, reserve),
464
465         TP_STRUCT__entry(
466                 __array(char,                   uuid,   16)
467                 __field(enum alloc_reserve,     reserve   )
468         ),
469
470         TP_fast_assign(
471                 memcpy(__entry->uuid, ca->uuid.b, 16);
472                 __entry->reserve = reserve;
473         ),
474
475         TP_printk("%pU reserve %d", __entry->uuid, __entry->reserve)
476 );
477
478 DEFINE_EVENT(bucket_alloc, bucket_alloc,
479         TP_PROTO(struct bch_dev *ca, enum alloc_reserve reserve),
480         TP_ARGS(ca, reserve)
481 );
482
483 DEFINE_EVENT(bucket_alloc, bucket_alloc_fail,
484         TP_PROTO(struct bch_dev *ca, enum alloc_reserve reserve),
485         TP_ARGS(ca, reserve)
486 );
487
488 DEFINE_EVENT(bucket_alloc, open_bucket_alloc_fail,
489         TP_PROTO(struct bch_dev *ca, enum alloc_reserve reserve),
490         TP_ARGS(ca, reserve)
491 );
492
493 /* Moving IO */
494
495 DEFINE_EVENT(bkey, move_extent,
496         TP_PROTO(const struct bkey *k),
497         TP_ARGS(k)
498 );
499
500 DEFINE_EVENT(bkey, move_alloc_fail,
501         TP_PROTO(const struct bkey *k),
502         TP_ARGS(k)
503 );
504
505 DEFINE_EVENT(bkey, move_race,
506         TP_PROTO(const struct bkey *k),
507         TP_ARGS(k)
508 );
509
510 TRACE_EVENT(move_data,
511         TP_PROTO(struct bch_fs *c, u64 sectors_moved,
512                  u64 keys_moved),
513         TP_ARGS(c, sectors_moved, keys_moved),
514
515         TP_STRUCT__entry(
516                 __array(char,           uuid,   16      )
517                 __field(u64,            sectors_moved   )
518                 __field(u64,            keys_moved      )
519         ),
520
521         TP_fast_assign(
522                 memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
523                 __entry->sectors_moved = sectors_moved;
524                 __entry->keys_moved = keys_moved;
525         ),
526
527         TP_printk("%pU sectors_moved %llu keys_moved %llu",
528                 __entry->uuid, __entry->sectors_moved, __entry->keys_moved)
529 );
530
531 TRACE_EVENT(copygc,
532         TP_PROTO(struct bch_fs *c,
533                  u64 sectors_moved, u64 sectors_not_moved,
534                  u64 buckets_moved, u64 buckets_not_moved),
535         TP_ARGS(c,
536                 sectors_moved, sectors_not_moved,
537                 buckets_moved, buckets_not_moved),
538
539         TP_STRUCT__entry(
540                 __array(char,           uuid,   16              )
541                 __field(u64,            sectors_moved           )
542                 __field(u64,            sectors_not_moved       )
543                 __field(u64,            buckets_moved           )
544                 __field(u64,            buckets_not_moved       )
545         ),
546
547         TP_fast_assign(
548                 memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
549                 __entry->sectors_moved          = sectors_moved;
550                 __entry->sectors_not_moved      = sectors_not_moved;
551                 __entry->buckets_moved          = buckets_moved;
552                 __entry->buckets_not_moved = buckets_moved;
553         ),
554
555         TP_printk("%pU sectors moved %llu remain %llu buckets moved %llu remain %llu",
556                 __entry->uuid,
557                 __entry->sectors_moved, __entry->sectors_not_moved,
558                 __entry->buckets_moved, __entry->buckets_not_moved)
559 );
560
561 TRACE_EVENT(transaction_restart_ip,
562         TP_PROTO(unsigned long caller, unsigned long ip),
563         TP_ARGS(caller, ip),
564
565         TP_STRUCT__entry(
566                 __field(unsigned long,          caller  )
567                 __field(unsigned long,          ip      )
568         ),
569
570         TP_fast_assign(
571                 __entry->caller = caller;
572                 __entry->ip     = ip;
573         ),
574
575         TP_printk("%ps %pS", (void *) __entry->caller, (void *) __entry->ip)
576 );
577
578 DECLARE_EVENT_CLASS(transaction_restart,
579         TP_PROTO(unsigned long ip),
580         TP_ARGS(ip),
581
582         TP_STRUCT__entry(
583                 __field(unsigned long,          ip      )
584         ),
585
586         TP_fast_assign(
587                 __entry->ip = ip;
588         ),
589
590         TP_printk("%ps", (void *) __entry->ip)
591 );
592
593 DEFINE_EVENT(transaction_restart,       trans_restart_btree_node_reused,
594         TP_PROTO(unsigned long ip),
595         TP_ARGS(ip)
596 );
597
598 TRACE_EVENT(trans_restart_would_deadlock,
599         TP_PROTO(unsigned long  trans_ip,
600                  unsigned long  caller_ip,
601                  unsigned       reason,
602                  enum btree_id  have_btree_id,
603                  unsigned       have_iter_type,
604                  enum btree_id  want_btree_id,
605                  unsigned       want_iter_type),
606         TP_ARGS(trans_ip, caller_ip, reason,
607                 have_btree_id, have_iter_type,
608                 want_btree_id, want_iter_type),
609
610         TP_STRUCT__entry(
611                 __field(unsigned long,          trans_ip        )
612                 __field(unsigned long,          caller_ip       )
613                 __field(u8,                     reason          )
614                 __field(u8,                     have_btree_id   )
615                 __field(u8,                     have_iter_type  )
616                 __field(u8,                     want_btree_id   )
617                 __field(u8,                     want_iter_type  )
618         ),
619
620         TP_fast_assign(
621                 __entry->trans_ip               = trans_ip;
622                 __entry->caller_ip              = caller_ip;
623                 __entry->reason                 = reason;
624                 __entry->have_btree_id          = have_btree_id;
625                 __entry->have_iter_type         = have_iter_type;
626                 __entry->want_btree_id          = want_btree_id;
627                 __entry->want_iter_type         = want_iter_type;
628         ),
629
630         TP_printk("%ps %pS because %u have %u:%u want %u:%u",
631                   (void *) __entry->trans_ip,
632                   (void *) __entry->caller_ip,
633                   __entry->reason,
634                   __entry->have_btree_id,
635                   __entry->have_iter_type,
636                   __entry->want_btree_id,
637                   __entry->want_iter_type)
638 );
639
640 TRACE_EVENT(trans_restart_iters_realloced,
641         TP_PROTO(unsigned long ip, unsigned nr),
642         TP_ARGS(ip, nr),
643
644         TP_STRUCT__entry(
645                 __field(unsigned long,          ip      )
646                 __field(unsigned,               nr      )
647         ),
648
649         TP_fast_assign(
650                 __entry->ip     = ip;
651                 __entry->nr     = nr;
652         ),
653
654         TP_printk("%ps nr %u", (void *) __entry->ip, __entry->nr)
655 );
656
657 TRACE_EVENT(trans_restart_mem_realloced,
658         TP_PROTO(unsigned long ip, unsigned long bytes),
659         TP_ARGS(ip, bytes),
660
661         TP_STRUCT__entry(
662                 __field(unsigned long,          ip      )
663                 __field(unsigned long,          bytes   )
664         ),
665
666         TP_fast_assign(
667                 __entry->ip     = ip;
668                 __entry->bytes  = bytes;
669         ),
670
671         TP_printk("%ps bytes %lu", (void *) __entry->ip, __entry->bytes)
672 );
673
674 DEFINE_EVENT(transaction_restart,       trans_restart_journal_res_get,
675         TP_PROTO(unsigned long ip),
676         TP_ARGS(ip)
677 );
678
679 DEFINE_EVENT(transaction_restart,       trans_restart_journal_preres_get,
680         TP_PROTO(unsigned long ip),
681         TP_ARGS(ip)
682 );
683
684 DEFINE_EVENT(transaction_restart,       trans_restart_journal_reclaim,
685         TP_PROTO(unsigned long ip),
686         TP_ARGS(ip)
687 );
688
689 DEFINE_EVENT(transaction_restart,       trans_restart_mark_replicas,
690         TP_PROTO(unsigned long ip),
691         TP_ARGS(ip)
692 );
693
694 DEFINE_EVENT(transaction_restart,       trans_restart_fault_inject,
695         TP_PROTO(unsigned long ip),
696         TP_ARGS(ip)
697 );
698
699 DEFINE_EVENT(transaction_restart,       trans_restart_btree_node_split,
700         TP_PROTO(unsigned long ip),
701         TP_ARGS(ip)
702 );
703
704 DEFINE_EVENT(transaction_restart,       trans_restart_mark,
705         TP_PROTO(unsigned long ip),
706         TP_ARGS(ip)
707 );
708
709 DEFINE_EVENT(transaction_restart,       trans_restart_upgrade,
710         TP_PROTO(unsigned long ip),
711         TP_ARGS(ip)
712 );
713
714 DEFINE_EVENT(transaction_restart,       trans_restart_iter_upgrade,
715         TP_PROTO(unsigned long ip),
716         TP_ARGS(ip)
717 );
718
719 DEFINE_EVENT(transaction_restart,       trans_restart_traverse,
720         TP_PROTO(unsigned long ip),
721         TP_ARGS(ip)
722 );
723
724 DECLARE_EVENT_CLASS(node_lock_fail,
725         TP_PROTO(unsigned level, u32 iter_seq, unsigned node, u32 node_seq),
726         TP_ARGS(level, iter_seq, node, node_seq),
727
728         TP_STRUCT__entry(
729                 __field(u32,            level)
730                 __field(u32,            iter_seq)
731                 __field(u32,            node)
732                 __field(u32,            node_seq)
733         ),
734
735         TP_fast_assign(
736                 __entry->level          = level;
737                 __entry->iter_seq       = iter_seq;
738                 __entry->node           = node;
739                 __entry->node_seq       = node_seq;
740         ),
741
742         TP_printk("level %u iter seq %u node %u node seq %u",
743                   __entry->level, __entry->iter_seq,
744                   __entry->node, __entry->node_seq)
745 );
746
747 DEFINE_EVENT(node_lock_fail, node_upgrade_fail,
748         TP_PROTO(unsigned level, u32 iter_seq, unsigned node, u32 node_seq),
749         TP_ARGS(level, iter_seq, node, node_seq)
750 );
751
752 DEFINE_EVENT(node_lock_fail, node_relock_fail,
753         TP_PROTO(unsigned level, u32 iter_seq, unsigned node, u32 node_seq),
754         TP_ARGS(level, iter_seq, node, node_seq)
755 );
756
757 #endif /* _TRACE_BCACHE_H */
758
759 /* This part must be outside protection */
760 #include <trace/define_trace.h>