2 #define TRACE_SYSTEM bcache
4 #if !defined(_TRACE_BCACHE_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_BCACHE_H
7 #include <linux/tracepoint.h>
11 DECLARE_EVENT_CLASS(bcache_request,
13 TP_PROTO(struct search *s, struct bio *bio),
19 __field(unsigned int, orig_major )
20 __field(unsigned int, orig_minor )
21 __field(sector_t, sector )
22 __field(dev_t, orig_sector )
23 __field(unsigned int, nr_sector )
24 __array(char, rwbs, 6 )
25 __array(char, comm, TASK_COMM_LEN )
29 __entry->dev = bio->bi_bdev->bd_dev;
30 __entry->orig_major = s->d->disk->major;
31 __entry->orig_minor = s->d->disk->first_minor;
32 __entry->sector = bio->bi_sector;
33 __entry->orig_sector = bio->bi_sector - 16;
34 __entry->nr_sector = bio->bi_size >> 9;
35 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
36 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
39 TP_printk("%d,%d %s %llu + %u [%s] (from %d,%d @ %llu)",
40 MAJOR(__entry->dev), MINOR(__entry->dev),
42 (unsigned long long)__entry->sector,
43 __entry->nr_sector, __entry->comm,
44 __entry->orig_major, __entry->orig_minor,
45 (unsigned long long)__entry->orig_sector)
48 DEFINE_EVENT(bcache_request, bcache_request_start,
50 TP_PROTO(struct search *s, struct bio *bio),
55 DEFINE_EVENT(bcache_request, bcache_request_end,
57 TP_PROTO(struct search *s, struct bio *bio),
62 DECLARE_EVENT_CLASS(bcache_bio,
64 TP_PROTO(struct bio *bio),
70 __field(sector_t, sector )
71 __field(unsigned int, nr_sector )
72 __array(char, rwbs, 6 )
73 __array(char, comm, TASK_COMM_LEN )
77 __entry->dev = bio->bi_bdev->bd_dev;
78 __entry->sector = bio->bi_sector;
79 __entry->nr_sector = bio->bi_size >> 9;
80 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
81 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
84 TP_printk("%d,%d %s %llu + %u [%s]",
85 MAJOR(__entry->dev), MINOR(__entry->dev),
87 (unsigned long long)__entry->sector,
88 __entry->nr_sector, __entry->comm)
92 DEFINE_EVENT(bcache_bio, bcache_passthrough,
94 TP_PROTO(struct bio *bio),
99 DEFINE_EVENT(bcache_bio, bcache_cache_hit,
101 TP_PROTO(struct bio *bio),
106 DEFINE_EVENT(bcache_bio, bcache_cache_miss,
108 TP_PROTO(struct bio *bio),
113 DEFINE_EVENT(bcache_bio, bcache_read_retry,
115 TP_PROTO(struct bio *bio),
120 DEFINE_EVENT(bcache_bio, bcache_writethrough,
122 TP_PROTO(struct bio *bio),
127 DEFINE_EVENT(bcache_bio, bcache_writeback,
129 TP_PROTO(struct bio *bio),
134 DEFINE_EVENT(bcache_bio, bcache_write_skip,
136 TP_PROTO(struct bio *bio),
141 DEFINE_EVENT(bcache_bio, bcache_btree_read,
143 TP_PROTO(struct bio *bio),
148 DEFINE_EVENT(bcache_bio, bcache_btree_write,
150 TP_PROTO(struct bio *bio),
155 DEFINE_EVENT(bcache_bio, bcache_write_dirty,
157 TP_PROTO(struct bio *bio),
162 DEFINE_EVENT(bcache_bio, bcache_read_dirty,
164 TP_PROTO(struct bio *bio),
169 DEFINE_EVENT(bcache_bio, bcache_write_moving,
171 TP_PROTO(struct bio *bio),
176 DEFINE_EVENT(bcache_bio, bcache_read_moving,
178 TP_PROTO(struct bio *bio),
183 DEFINE_EVENT(bcache_bio, bcache_journal_write,
185 TP_PROTO(struct bio *bio),
190 DECLARE_EVENT_CLASS(bcache_cache_bio,
192 TP_PROTO(struct bio *bio,
193 sector_t orig_sector,
194 struct block_device* orig_bdev),
196 TP_ARGS(bio, orig_sector, orig_bdev),
200 __field(dev_t, orig_dev )
201 __field(sector_t, sector )
202 __field(sector_t, orig_sector )
203 __field(unsigned int, nr_sector )
204 __array(char, rwbs, 6 )
205 __array(char, comm, TASK_COMM_LEN )
209 __entry->dev = bio->bi_bdev->bd_dev;
210 __entry->orig_dev = orig_bdev->bd_dev;
211 __entry->sector = bio->bi_sector;
212 __entry->orig_sector = orig_sector;
213 __entry->nr_sector = bio->bi_size >> 9;
214 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
215 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
218 TP_printk("%d,%d %s %llu + %u [%s] (from %d,%d %llu)",
219 MAJOR(__entry->dev), MINOR(__entry->dev),
221 (unsigned long long)__entry->sector,
222 __entry->nr_sector, __entry->comm,
223 MAJOR(__entry->orig_dev), MINOR(__entry->orig_dev),
224 (unsigned long long)__entry->orig_sector)
227 DEFINE_EVENT(bcache_cache_bio, bcache_cache_insert,
229 TP_PROTO(struct bio *bio,
230 sector_t orig_sector,
231 struct block_device *orig_bdev),
233 TP_ARGS(bio, orig_sector, orig_bdev)
236 DECLARE_EVENT_CLASS(bcache_gc,
238 TP_PROTO(uint8_t *uuid),
243 __field(uint8_t *, uuid)
247 __entry->uuid = uuid;
250 TP_printk("%pU", __entry->uuid)
254 DEFINE_EVENT(bcache_gc, bcache_gc_start,
256 TP_PROTO(uint8_t *uuid),
261 DEFINE_EVENT(bcache_gc, bcache_gc_end,
263 TP_PROTO(uint8_t *uuid),
268 #endif /* _TRACE_BCACHE_H */
270 /* This part must be outside protection */
271 #include <trace/define_trace.h>