Commit 8c1cf6bb02fda79b0a4b9bd121f6be6d4ce7a15a

Authored by Tejun Heo
Committed by Jens Axboe
1 parent 3a366e614d

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>

Showing 3 changed files with 38 additions and 13 deletions Side-by-side Diff

... ... @@ -1347,7 +1347,7 @@
1347 1347 if (!ll_back_merge_fn(q, req, bio))
1348 1348 return false;
1349 1349  
1350   - trace_block_bio_backmerge(q, bio);
  1350 + trace_block_bio_backmerge(q, req, bio);
1351 1351  
1352 1352 if ((req->cmd_flags & REQ_FAILFAST_MASK) != ff)
1353 1353 blk_rq_set_mixed_merge(req);
... ... @@ -1369,7 +1369,7 @@
1369 1369 if (!ll_front_merge_fn(q, req, bio))
1370 1370 return false;
1371 1371  
1372   - trace_block_bio_frontmerge(q, bio);
  1372 + trace_block_bio_frontmerge(q, req, bio);
1373 1373  
1374 1374 if ((req->cmd_flags & REQ_FAILFAST_MASK) != ff)
1375 1375 blk_rq_set_mixed_merge(req);
include/trace/events/block.h
... ... @@ -241,11 +241,11 @@
241 241 __entry->nr_sector, __entry->error)
242 242 );
243 243  
244   -DECLARE_EVENT_CLASS(block_bio,
  244 +DECLARE_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 250 TP_STRUCT__entry(
251 251 __field( dev_t, dev )
252 252  
253 253  
254 254  
255 255  
256 256  
257 257  
258 258  
... ... @@ -272,31 +272,33 @@
272 272 /**
273 273 * block_bio_backmerge - merging block operation to the end of an existing operation
274 274 * @q: queue holding operation
  275 + * @rq: request bio is being merged into
275 276 * @bio: new block operation to merge
276 277 *
277 278 * Merging block request @bio to the end of an existing block request
278 279 * in queue @q.
279 280 */
280   -DEFINE_EVENT(block_bio, block_bio_backmerge,
  281 +DEFINE_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 289 * block_bio_frontmerge - merging block operation to the beginning of an existing operation
289 290 * @q: queue holding operation
  291 + * @rq: request bio is being merged into
290 292 * @bio: new block operation to merge
291 293 *
292 294 * Merging block IO operation @bio to the beginning of an existing block
293 295 * operation in queue @q.
294 296 */
295   -DEFINE_EVENT(block_bio, block_bio_frontmerge,
  297 +DEFINE_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 /**
303 305  
... ... @@ -306,11 +308,32 @@
306 308 *
307 309 * About to place the block IO operation @bio into queue @q.
308 310 */
309   -DEFINE_EVENT(block_bio, block_bio_queue,
  311 +TRACE_EVENT(block_bio_queue,
310 312  
311 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  
316 339 DECLARE_EVENT_CLASS(block_get_rq,
kernel/trace/blktrace.c
... ... @@ -803,6 +803,7 @@
803 803  
804 804 static void blk_add_trace_bio_backmerge(void *ignore,
805 805 struct request_queue *q,
  806 + struct request *rq,
806 807 struct bio *bio)
807 808 {
808 809 blk_add_trace_bio(q, bio, BLK_TA_BACKMERGE, 0);
... ... @@ -810,6 +811,7 @@
810 811  
811 812 static void blk_add_trace_bio_frontmerge(void *ignore,
812 813 struct request_queue *q,
  814 + struct request *rq,
813 815 struct bio *bio)
814 816 {
815 817 blk_add_trace_bio(q, bio, BLK_TA_FRONTMERGE, 0);