aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-01-11 16:06:34 -0500
committerJens Axboe <axboe@kernel.dk>2013-01-14 09:00:36 -0500
commit8c1cf6bb02fda79b0a4b9bd121f6be6d4ce7a15a (patch)
treee10008c7fb3c7b8cf832712dd6e7b55f149a49e6
parent3a366e614d0837d9fc23f78cdb1a1186ebc3387f (diff)
block: add @req to bio_{front|back}_merge tracepoints
bio_{front|back}_merge tracepoints report a bio merging into an existing request but didn't specify which request the bio is being merged into. Add @req to it. This makes it impossible to share the event template with block_bio_queue - split it out. @req isn't used or exported to userland at this point and there is no userland visible behavior change. Later changes will make use of the extra parameter. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--block/blk-core.c4
-rw-r--r--include/trace/events/block.h45
-rw-r--r--kernel/trace/blktrace.c2
3 files changed, 38 insertions, 13 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 4f5aec708be6..66d31687cf6b 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1347,7 +1347,7 @@ static bool bio_attempt_back_merge(struct request_queue *q, struct request *req,
1347 if (!ll_back_merge_fn(q, req, bio)) 1347 if (!ll_back_merge_fn(q, req, bio))
1348 return false; 1348 return false;
1349 1349
1350 trace_block_bio_backmerge(q, bio); 1350 trace_block_bio_backmerge(q, req, bio);
1351 1351
1352 if ((req->cmd_flags & REQ_FAILFAST_MASK) != ff) 1352 if ((req->cmd_flags & REQ_FAILFAST_MASK) != ff)
1353 blk_rq_set_mixed_merge(req); 1353 blk_rq_set_mixed_merge(req);
@@ -1369,7 +1369,7 @@ static bool bio_attempt_front_merge(struct request_queue *q,
1369 if (!ll_front_merge_fn(q, req, bio)) 1369 if (!ll_front_merge_fn(q, req, bio))
1370 return false; 1370 return false;
1371 1371
1372 trace_block_bio_frontmerge(q, bio); 1372 trace_block_bio_frontmerge(q, req, bio);
1373 1373
1374 if ((req->cmd_flags & REQ_FAILFAST_MASK) != ff) 1374 if ((req->cmd_flags & REQ_FAILFAST_MASK) != ff)
1375 blk_rq_set_mixed_merge(req); 1375 blk_rq_set_mixed_merge(req);
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 8a168db9a645..b408f518a819 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -241,11 +241,11 @@ TRACE_EVENT(block_bio_complete,
241 __entry->nr_sector, __entry->error) 241 __entry->nr_sector, __entry->error)
242); 242);
243 243
244DECLARE_EVENT_CLASS(block_bio, 244DECLARE_EVENT_CLASS(block_bio_merge,
245 245
246 TP_PROTO(struct request_queue *q, struct bio *bio), 246 TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
247 247
248 TP_ARGS(q, bio), 248 TP_ARGS(q, rq, bio),
249 249
250 TP_STRUCT__entry( 250 TP_STRUCT__entry(
251 __field( dev_t, dev ) 251 __field( dev_t, dev )
@@ -272,31 +272,33 @@ DECLARE_EVENT_CLASS(block_bio,
272/** 272/**
273 * block_bio_backmerge - merging block operation to the end of an existing operation 273 * block_bio_backmerge - merging block operation to the end of an existing operation
274 * @q: queue holding operation 274 * @q: queue holding operation
275 * @rq: request bio is being merged into
275 * @bio: new block operation to merge 276 * @bio: new block operation to merge
276 * 277 *
277 * Merging block request @bio to the end of an existing block request 278 * Merging block request @bio to the end of an existing block request
278 * in queue @q. 279 * in queue @q.
279 */ 280 */
280DEFINE_EVENT(block_bio, block_bio_backmerge, 281DEFINE_EVENT(block_bio_merge, block_bio_backmerge,
281 282
282 TP_PROTO(struct request_queue *q, struct bio *bio), 283 TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
283 284
284 TP_ARGS(q, bio) 285 TP_ARGS(q, rq, bio)
285); 286);
286 287
287/** 288/**
288 * block_bio_frontmerge - merging block operation to the beginning of an existing operation 289 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
289 * @q: queue holding operation 290 * @q: queue holding operation
291 * @rq: request bio is being merged into
290 * @bio: new block operation to merge 292 * @bio: new block operation to merge
291 * 293 *
292 * Merging block IO operation @bio to the beginning of an existing block 294 * Merging block IO operation @bio to the beginning of an existing block
293 * operation in queue @q. 295 * operation in queue @q.
294 */ 296 */
295DEFINE_EVENT(block_bio, block_bio_frontmerge, 297DEFINE_EVENT(block_bio_merge, block_bio_frontmerge,
296 298
297 TP_PROTO(struct request_queue *q, struct bio *bio), 299 TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
298 300
299 TP_ARGS(q, bio) 301 TP_ARGS(q, rq, bio)
300); 302);
301 303
302/** 304/**
@@ -306,11 +308,32 @@ DEFINE_EVENT(block_bio, block_bio_frontmerge,
306 * 308 *
307 * About to place the block IO operation @bio into queue @q. 309 * About to place the block IO operation @bio into queue @q.
308 */ 310 */
309DEFINE_EVENT(block_bio, block_bio_queue, 311TRACE_EVENT(block_bio_queue,
310 312
311 TP_PROTO(struct request_queue *q, struct bio *bio), 313 TP_PROTO(struct request_queue *q, struct bio *bio),
312 314
313 TP_ARGS(q, bio) 315 TP_ARGS(q, bio),
316
317 TP_STRUCT__entry(
318 __field( dev_t, dev )
319 __field( sector_t, sector )
320 __field( unsigned int, nr_sector )
321 __array( char, rwbs, RWBS_LEN )
322 __array( char, comm, TASK_COMM_LEN )
323 ),
324
325 TP_fast_assign(
326 __entry->dev = bio->bi_bdev->bd_dev;
327 __entry->sector = bio->bi_sector;
328 __entry->nr_sector = bio->bi_size >> 9;
329 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
330 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
331 ),
332
333 TP_printk("%d,%d %s %llu + %u [%s]",
334 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
335 (unsigned long long)__entry->sector,
336 __entry->nr_sector, __entry->comm)
314); 337);
315 338
316DECLARE_EVENT_CLASS(block_get_rq, 339DECLARE_EVENT_CLASS(block_get_rq,
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 190d98fbed27..fb593f6a687e 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -803,6 +803,7 @@ static void blk_add_trace_bio_complete(void *ignore, struct bio *bio, int error)
803 803
804static void blk_add_trace_bio_backmerge(void *ignore, 804static void blk_add_trace_bio_backmerge(void *ignore,
805 struct request_queue *q, 805 struct request_queue *q,
806 struct request *rq,
806 struct bio *bio) 807 struct bio *bio)
807{ 808{
808 blk_add_trace_bio(q, bio, BLK_TA_BACKMERGE, 0); 809 blk_add_trace_bio(q, bio, BLK_TA_BACKMERGE, 0);
@@ -810,6 +811,7 @@ static void blk_add_trace_bio_backmerge(void *ignore,
810 811
811static void blk_add_trace_bio_frontmerge(void *ignore, 812static void blk_add_trace_bio_frontmerge(void *ignore,
812 struct request_queue *q, 813 struct request_queue *q,
814 struct request *rq,
813 struct bio *bio) 815 struct bio *bio)
814{ 816{
815 blk_add_trace_bio(q, bio, BLK_TA_FRONTMERGE, 0); 817 blk_add_trace_bio(q, bio, BLK_TA_FRONTMERGE, 0);