diff options
Diffstat (limited to 'include/trace/events/block.h')
-rw-r--r-- | include/trace/events/block.h | 104 |
1 files changed, 89 insertions, 15 deletions
diff --git a/include/trace/events/block.h b/include/trace/events/block.h index 05c5e61f0a7c..9961726523d0 100644 --- a/include/trace/events/block.h +++ b/include/trace/events/block.h | |||
@@ -6,10 +6,61 @@ | |||
6 | 6 | ||
7 | #include <linux/blktrace_api.h> | 7 | #include <linux/blktrace_api.h> |
8 | #include <linux/blkdev.h> | 8 | #include <linux/blkdev.h> |
9 | #include <linux/buffer_head.h> | ||
9 | #include <linux/tracepoint.h> | 10 | #include <linux/tracepoint.h> |
10 | 11 | ||
11 | #define RWBS_LEN 8 | 12 | #define RWBS_LEN 8 |
12 | 13 | ||
14 | DECLARE_EVENT_CLASS(block_buffer, | ||
15 | |||
16 | TP_PROTO(struct buffer_head *bh), | ||
17 | |||
18 | TP_ARGS(bh), | ||
19 | |||
20 | TP_STRUCT__entry ( | ||
21 | __field( dev_t, dev ) | ||
22 | __field( sector_t, sector ) | ||
23 | __field( size_t, size ) | ||
24 | ), | ||
25 | |||
26 | TP_fast_assign( | ||
27 | __entry->dev = bh->b_bdev->bd_dev; | ||
28 | __entry->sector = bh->b_blocknr; | ||
29 | __entry->size = bh->b_size; | ||
30 | ), | ||
31 | |||
32 | TP_printk("%d,%d sector=%llu size=%zu", | ||
33 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
34 | (unsigned long long)__entry->sector, __entry->size | ||
35 | ) | ||
36 | ); | ||
37 | |||
38 | /** | ||
39 | * block_touch_buffer - mark a buffer accessed | ||
40 | * @bh: buffer_head being touched | ||
41 | * | ||
42 | * Called from touch_buffer(). | ||
43 | */ | ||
44 | DEFINE_EVENT(block_buffer, block_touch_buffer, | ||
45 | |||
46 | TP_PROTO(struct buffer_head *bh), | ||
47 | |||
48 | TP_ARGS(bh) | ||
49 | ); | ||
50 | |||
51 | /** | ||
52 | * block_dirty_buffer - mark a buffer dirty | ||
53 | * @bh: buffer_head being dirtied | ||
54 | * | ||
55 | * Called from mark_buffer_dirty(). | ||
56 | */ | ||
57 | DEFINE_EVENT(block_buffer, block_dirty_buffer, | ||
58 | |||
59 | TP_PROTO(struct buffer_head *bh), | ||
60 | |||
61 | TP_ARGS(bh) | ||
62 | ); | ||
63 | |||
13 | DECLARE_EVENT_CLASS(block_rq_with_error, | 64 | DECLARE_EVENT_CLASS(block_rq_with_error, |
14 | 65 | ||
15 | TP_PROTO(struct request_queue *q, struct request *rq), | 66 | TP_PROTO(struct request_queue *q, struct request *rq), |
@@ -206,7 +257,6 @@ TRACE_EVENT(block_bio_bounce, | |||
206 | 257 | ||
207 | /** | 258 | /** |
208 | * block_bio_complete - completed all work on the block operation | 259 | * block_bio_complete - completed all work on the block operation |
209 | * @q: queue holding the block operation | ||
210 | * @bio: block operation completed | 260 | * @bio: block operation completed |
211 | * @error: io error value | 261 | * @error: io error value |
212 | * | 262 | * |
@@ -215,9 +265,9 @@ TRACE_EVENT(block_bio_bounce, | |||
215 | */ | 265 | */ |
216 | TRACE_EVENT(block_bio_complete, | 266 | TRACE_EVENT(block_bio_complete, |
217 | 267 | ||
218 | TP_PROTO(struct request_queue *q, struct bio *bio, int error), | 268 | TP_PROTO(struct bio *bio, int error), |
219 | 269 | ||
220 | TP_ARGS(q, bio, error), | 270 | TP_ARGS(bio, error), |
221 | 271 | ||
222 | TP_STRUCT__entry( | 272 | TP_STRUCT__entry( |
223 | __field( dev_t, dev ) | 273 | __field( dev_t, dev ) |
@@ -228,7 +278,8 @@ TRACE_EVENT(block_bio_complete, | |||
228 | ), | 278 | ), |
229 | 279 | ||
230 | TP_fast_assign( | 280 | TP_fast_assign( |
231 | __entry->dev = bio->bi_bdev->bd_dev; | 281 | __entry->dev = bio->bi_bdev ? |
282 | bio->bi_bdev->bd_dev : 0; | ||
232 | __entry->sector = bio->bi_sector; | 283 | __entry->sector = bio->bi_sector; |
233 | __entry->nr_sector = bio->bi_size >> 9; | 284 | __entry->nr_sector = bio->bi_size >> 9; |
234 | __entry->error = error; | 285 | __entry->error = error; |
@@ -241,11 +292,11 @@ TRACE_EVENT(block_bio_complete, | |||
241 | __entry->nr_sector, __entry->error) | 292 | __entry->nr_sector, __entry->error) |
242 | ); | 293 | ); |
243 | 294 | ||
244 | DECLARE_EVENT_CLASS(block_bio, | 295 | DECLARE_EVENT_CLASS(block_bio_merge, |
245 | 296 | ||
246 | TP_PROTO(struct request_queue *q, struct bio *bio), | 297 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), |
247 | 298 | ||
248 | TP_ARGS(q, bio), | 299 | TP_ARGS(q, rq, bio), |
249 | 300 | ||
250 | TP_STRUCT__entry( | 301 | TP_STRUCT__entry( |
251 | __field( dev_t, dev ) | 302 | __field( dev_t, dev ) |
@@ -272,31 +323,33 @@ DECLARE_EVENT_CLASS(block_bio, | |||
272 | /** | 323 | /** |
273 | * block_bio_backmerge - merging block operation to the end of an existing operation | 324 | * block_bio_backmerge - merging block operation to the end of an existing operation |
274 | * @q: queue holding operation | 325 | * @q: queue holding operation |
326 | * @rq: request bio is being merged into | ||
275 | * @bio: new block operation to merge | 327 | * @bio: new block operation to merge |
276 | * | 328 | * |
277 | * Merging block request @bio to the end of an existing block request | 329 | * Merging block request @bio to the end of an existing block request |
278 | * in queue @q. | 330 | * in queue @q. |
279 | */ | 331 | */ |
280 | DEFINE_EVENT(block_bio, block_bio_backmerge, | 332 | DEFINE_EVENT(block_bio_merge, block_bio_backmerge, |
281 | 333 | ||
282 | TP_PROTO(struct request_queue *q, struct bio *bio), | 334 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), |
283 | 335 | ||
284 | TP_ARGS(q, bio) | 336 | TP_ARGS(q, rq, bio) |
285 | ); | 337 | ); |
286 | 338 | ||
287 | /** | 339 | /** |
288 | * block_bio_frontmerge - merging block operation to the beginning of an existing operation | 340 | * block_bio_frontmerge - merging block operation to the beginning of an existing operation |
289 | * @q: queue holding operation | 341 | * @q: queue holding operation |
342 | * @rq: request bio is being merged into | ||
290 | * @bio: new block operation to merge | 343 | * @bio: new block operation to merge |
291 | * | 344 | * |
292 | * Merging block IO operation @bio to the beginning of an existing block | 345 | * Merging block IO operation @bio to the beginning of an existing block |
293 | * operation in queue @q. | 346 | * operation in queue @q. |
294 | */ | 347 | */ |
295 | DEFINE_EVENT(block_bio, block_bio_frontmerge, | 348 | DEFINE_EVENT(block_bio_merge, block_bio_frontmerge, |
296 | 349 | ||
297 | TP_PROTO(struct request_queue *q, struct bio *bio), | 350 | TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio), |
298 | 351 | ||
299 | TP_ARGS(q, bio) | 352 | TP_ARGS(q, rq, bio) |
300 | ); | 353 | ); |
301 | 354 | ||
302 | /** | 355 | /** |
@@ -306,11 +359,32 @@ DEFINE_EVENT(block_bio, block_bio_frontmerge, | |||
306 | * | 359 | * |
307 | * About to place the block IO operation @bio into queue @q. | 360 | * About to place the block IO operation @bio into queue @q. |
308 | */ | 361 | */ |
309 | DEFINE_EVENT(block_bio, block_bio_queue, | 362 | TRACE_EVENT(block_bio_queue, |
310 | 363 | ||
311 | TP_PROTO(struct request_queue *q, struct bio *bio), | 364 | TP_PROTO(struct request_queue *q, struct bio *bio), |
312 | 365 | ||
313 | TP_ARGS(q, bio) | 366 | TP_ARGS(q, bio), |
367 | |||
368 | TP_STRUCT__entry( | ||
369 | __field( dev_t, dev ) | ||
370 | __field( sector_t, sector ) | ||
371 | __field( unsigned int, nr_sector ) | ||
372 | __array( char, rwbs, RWBS_LEN ) | ||
373 | __array( char, comm, TASK_COMM_LEN ) | ||
374 | ), | ||
375 | |||
376 | TP_fast_assign( | ||
377 | __entry->dev = bio->bi_bdev->bd_dev; | ||
378 | __entry->sector = bio->bi_sector; | ||
379 | __entry->nr_sector = bio->bi_size >> 9; | ||
380 | blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); | ||
381 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); | ||
382 | ), | ||
383 | |||
384 | TP_printk("%d,%d %s %llu + %u [%s]", | ||
385 | MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, | ||
386 | (unsigned long long)__entry->sector, | ||
387 | __entry->nr_sector, __entry->comm) | ||
314 | ); | 388 | ); |
315 | 389 | ||
316 | DECLARE_EVENT_CLASS(block_get_rq, | 390 | DECLARE_EVENT_CLASS(block_get_rq, |