Merge tag 'kvm-3.10-2' of git://git.kernel.org/pub/scm/virt/kvm/kvm
[firefly-linux-kernel-4.4.55.git] / include / trace / events / bcache.h
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM bcache
3
4 #if !defined(_TRACE_BCACHE_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_BCACHE_H
6
7 #include <linux/tracepoint.h>
8
9 struct search;
10
11 DECLARE_EVENT_CLASS(bcache_request,
12
13         TP_PROTO(struct search *s, struct bio *bio),
14
15         TP_ARGS(s, bio),
16
17         TP_STRUCT__entry(
18                 __field(dev_t,          dev                     )
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   )
26         ),
27
28         TP_fast_assign(
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);
37         ),
38
39         TP_printk("%d,%d %s %llu + %u [%s] (from %d,%d @ %llu)",
40                   MAJOR(__entry->dev), MINOR(__entry->dev),
41                   __entry->rwbs,
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)
46 );
47
48 DEFINE_EVENT(bcache_request, bcache_request_start,
49
50         TP_PROTO(struct search *s, struct bio *bio),
51
52         TP_ARGS(s, bio)
53 );
54
55 DEFINE_EVENT(bcache_request, bcache_request_end,
56
57         TP_PROTO(struct search *s, struct bio *bio),
58
59         TP_ARGS(s, bio)
60 );
61
62 DECLARE_EVENT_CLASS(bcache_bio,
63
64         TP_PROTO(struct bio *bio),
65
66         TP_ARGS(bio),
67
68         TP_STRUCT__entry(
69                 __field(dev_t,          dev                     )
70                 __field(sector_t,       sector                  )
71                 __field(unsigned int,   nr_sector               )
72                 __array(char,           rwbs,   6               )
73                 __array(char,           comm,   TASK_COMM_LEN   )
74         ),
75
76         TP_fast_assign(
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);
82         ),
83
84         TP_printk("%d,%d  %s %llu + %u [%s]",
85                   MAJOR(__entry->dev), MINOR(__entry->dev),
86                   __entry->rwbs,
87                   (unsigned long long)__entry->sector,
88                   __entry->nr_sector, __entry->comm)
89 );
90
91
92 DEFINE_EVENT(bcache_bio, bcache_passthrough,
93
94         TP_PROTO(struct bio *bio),
95
96         TP_ARGS(bio)
97 );
98
99 DEFINE_EVENT(bcache_bio, bcache_cache_hit,
100
101         TP_PROTO(struct bio *bio),
102
103         TP_ARGS(bio)
104 );
105
106 DEFINE_EVENT(bcache_bio, bcache_cache_miss,
107
108         TP_PROTO(struct bio *bio),
109
110         TP_ARGS(bio)
111 );
112
113 DEFINE_EVENT(bcache_bio, bcache_read_retry,
114
115         TP_PROTO(struct bio *bio),
116
117         TP_ARGS(bio)
118 );
119
120 DEFINE_EVENT(bcache_bio, bcache_writethrough,
121
122         TP_PROTO(struct bio *bio),
123
124         TP_ARGS(bio)
125 );
126
127 DEFINE_EVENT(bcache_bio, bcache_writeback,
128
129         TP_PROTO(struct bio *bio),
130
131         TP_ARGS(bio)
132 );
133
134 DEFINE_EVENT(bcache_bio, bcache_write_skip,
135
136         TP_PROTO(struct bio *bio),
137
138         TP_ARGS(bio)
139 );
140
141 DEFINE_EVENT(bcache_bio, bcache_btree_read,
142
143         TP_PROTO(struct bio *bio),
144
145         TP_ARGS(bio)
146 );
147
148 DEFINE_EVENT(bcache_bio, bcache_btree_write,
149
150         TP_PROTO(struct bio *bio),
151
152         TP_ARGS(bio)
153 );
154
155 DEFINE_EVENT(bcache_bio, bcache_write_dirty,
156
157         TP_PROTO(struct bio *bio),
158
159         TP_ARGS(bio)
160 );
161
162 DEFINE_EVENT(bcache_bio, bcache_read_dirty,
163
164         TP_PROTO(struct bio *bio),
165
166         TP_ARGS(bio)
167 );
168
169 DEFINE_EVENT(bcache_bio, bcache_write_moving,
170
171         TP_PROTO(struct bio *bio),
172
173         TP_ARGS(bio)
174 );
175
176 DEFINE_EVENT(bcache_bio, bcache_read_moving,
177
178         TP_PROTO(struct bio *bio),
179
180         TP_ARGS(bio)
181 );
182
183 DEFINE_EVENT(bcache_bio, bcache_journal_write,
184
185         TP_PROTO(struct bio *bio),
186
187         TP_ARGS(bio)
188 );
189
190 DECLARE_EVENT_CLASS(bcache_cache_bio,
191
192         TP_PROTO(struct bio *bio,
193                  sector_t orig_sector,
194                  struct block_device* orig_bdev),
195
196         TP_ARGS(bio, orig_sector, orig_bdev),
197
198         TP_STRUCT__entry(
199                 __field(dev_t,          dev                     )
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   )
206         ),
207
208         TP_fast_assign(
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);
216         ),
217
218         TP_printk("%d,%d  %s %llu + %u [%s] (from %d,%d %llu)",
219                   MAJOR(__entry->dev), MINOR(__entry->dev),
220                   __entry->rwbs,
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)
225 );
226
227 DEFINE_EVENT(bcache_cache_bio, bcache_cache_insert,
228
229         TP_PROTO(struct bio *bio,
230                  sector_t orig_sector,
231                  struct block_device *orig_bdev),
232
233         TP_ARGS(bio, orig_sector, orig_bdev)
234 );
235
236 DECLARE_EVENT_CLASS(bcache_gc,
237
238         TP_PROTO(uint8_t *uuid),
239
240         TP_ARGS(uuid),
241
242         TP_STRUCT__entry(
243                 __field(uint8_t *,      uuid)
244         ),
245
246         TP_fast_assign(
247                 __entry->uuid           = uuid;
248         ),
249
250         TP_printk("%pU", __entry->uuid)
251 );
252
253
254 DEFINE_EVENT(bcache_gc, bcache_gc_start,
255
256              TP_PROTO(uint8_t *uuid),
257
258              TP_ARGS(uuid)
259 );
260
261 DEFINE_EVENT(bcache_gc, bcache_gc_end,
262
263              TP_PROTO(uint8_t *uuid),
264
265              TP_ARGS(uuid)
266 );
267
268 #endif /* _TRACE_BCACHE_H */
269
270 /* This part must be outside protection */
271 #include <trace/define_trace.h>