block.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM block
  3. #if !defined(_TRACE_BLOCK_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_BLOCK_H
  5. #include <linux/blktrace_api.h>
  6. #include <linux/blkdev.h>
  7. #include <linux/buffer_head.h>
  8. #include <linux/tracepoint.h>
  9. #define RWBS_LEN 8
  10. DECLARE_EVENT_CLASS(block_buffer,
  11. TP_PROTO(struct buffer_head *bh),
  12. TP_ARGS(bh),
  13. TP_STRUCT__entry (
  14. __field( dev_t, dev )
  15. __field( sector_t, sector )
  16. __field( size_t, size )
  17. ),
  18. TP_fast_assign(
  19. __entry->dev = bh->b_bdev->bd_dev;
  20. __entry->sector = bh->b_blocknr;
  21. __entry->size = bh->b_size;
  22. ),
  23. TP_printk("%d,%d sector=%llu size=%zu",
  24. MAJOR(__entry->dev), MINOR(__entry->dev),
  25. (unsigned long long)__entry->sector, __entry->size
  26. )
  27. );
  28. /**
  29. * block_touch_buffer - mark a buffer accessed
  30. * @bh: buffer_head being touched
  31. *
  32. * Called from touch_buffer().
  33. */
  34. DEFINE_EVENT(block_buffer, block_touch_buffer,
  35. TP_PROTO(struct buffer_head *bh),
  36. TP_ARGS(bh)
  37. );
  38. /**
  39. * block_dirty_buffer - mark a buffer dirty
  40. * @bh: buffer_head being dirtied
  41. *
  42. * Called from mark_buffer_dirty().
  43. */
  44. DEFINE_EVENT(block_buffer, block_dirty_buffer,
  45. TP_PROTO(struct buffer_head *bh),
  46. TP_ARGS(bh)
  47. );
  48. DECLARE_EVENT_CLASS(block_rq_with_error,
  49. TP_PROTO(struct request_queue *q, struct request *rq),
  50. TP_ARGS(q, rq),
  51. TP_STRUCT__entry(
  52. __field( dev_t, dev )
  53. __field( sector_t, sector )
  54. __field( unsigned int, nr_sector )
  55. __field( int, errors )
  56. __array( char, rwbs, RWBS_LEN )
  57. __dynamic_array( char, cmd, blk_cmd_buf_len(rq) )
  58. ),
  59. TP_fast_assign(
  60. __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
  61. __entry->sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
  62. 0 : blk_rq_pos(rq);
  63. __entry->nr_sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
  64. 0 : blk_rq_sectors(rq);
  65. __entry->errors = rq->errors;
  66. blk_fill_rwbs(__entry->rwbs, req_op(rq), rq->cmd_flags,
  67. blk_rq_bytes(rq));
  68. blk_dump_cmd(__get_str(cmd), rq);
  69. ),
  70. TP_printk("%d,%d %s (%s) %llu + %u [%d]",
  71. MAJOR(__entry->dev), MINOR(__entry->dev),
  72. __entry->rwbs, __get_str(cmd),
  73. (unsigned long long)__entry->sector,
  74. __entry->nr_sector, __entry->errors)
  75. );
  76. /**
  77. * block_rq_abort - abort block operation request
  78. * @q: queue containing the block operation request
  79. * @rq: block IO operation request
  80. *
  81. * Called immediately after pending block IO operation request @rq in
  82. * queue @q is aborted. The fields in the operation request @rq
  83. * can be examined to determine which device and sectors the pending
  84. * operation would access.
  85. */
  86. DEFINE_EVENT(block_rq_with_error, block_rq_abort,
  87. TP_PROTO(struct request_queue *q, struct request *rq),
  88. TP_ARGS(q, rq)
  89. );
  90. /**
  91. * block_rq_requeue - place block IO request back on a queue
  92. * @q: queue holding operation
  93. * @rq: block IO operation request
  94. *
  95. * The block operation request @rq is being placed back into queue
  96. * @q. For some reason the request was not completed and needs to be
  97. * put back in the queue.
  98. */
  99. DEFINE_EVENT(block_rq_with_error, block_rq_requeue,
  100. TP_PROTO(struct request_queue *q, struct request *rq),
  101. TP_ARGS(q, rq)
  102. );
  103. /**
  104. * block_rq_complete - block IO operation completed by device driver
  105. * @q: queue containing the block operation request
  106. * @rq: block operations request
  107. * @nr_bytes: number of completed bytes
  108. *
  109. * The block_rq_complete tracepoint event indicates that some portion
  110. * of operation request has been completed by the device driver. If
  111. * the @rq->bio is %NULL, then there is absolutely no additional work to
  112. * do for the request. If @rq->bio is non-NULL then there is
  113. * additional work required to complete the request.
  114. */
  115. TRACE_EVENT(block_rq_complete,
  116. TP_PROTO(struct request_queue *q, struct request *rq,
  117. unsigned int nr_bytes),
  118. TP_ARGS(q, rq, nr_bytes),
  119. TP_STRUCT__entry(
  120. __field( dev_t, dev )
  121. __field( sector_t, sector )
  122. __field( unsigned int, nr_sector )
  123. __field( int, errors )
  124. __array( char, rwbs, RWBS_LEN )
  125. __dynamic_array( char, cmd, blk_cmd_buf_len(rq) )
  126. ),
  127. TP_fast_assign(
  128. __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
  129. __entry->sector = blk_rq_pos(rq);
  130. __entry->nr_sector = nr_bytes >> 9;
  131. __entry->errors = rq->errors;
  132. blk_fill_rwbs(__entry->rwbs, req_op(rq), rq->cmd_flags, nr_bytes);
  133. blk_dump_cmd(__get_str(cmd), rq);
  134. ),
  135. TP_printk("%d,%d %s (%s) %llu + %u [%d]",
  136. MAJOR(__entry->dev), MINOR(__entry->dev),
  137. __entry->rwbs, __get_str(cmd),
  138. (unsigned long long)__entry->sector,
  139. __entry->nr_sector, __entry->errors)
  140. );
  141. DECLARE_EVENT_CLASS(block_rq,
  142. TP_PROTO(struct request_queue *q, struct request *rq),
  143. TP_ARGS(q, rq),
  144. TP_STRUCT__entry(
  145. __field( dev_t, dev )
  146. __field( sector_t, sector )
  147. __field( unsigned int, nr_sector )
  148. __field( unsigned int, bytes )
  149. __array( char, rwbs, RWBS_LEN )
  150. __array( char, comm, TASK_COMM_LEN )
  151. __dynamic_array( char, cmd, blk_cmd_buf_len(rq) )
  152. ),
  153. TP_fast_assign(
  154. __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
  155. __entry->sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
  156. 0 : blk_rq_pos(rq);
  157. __entry->nr_sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
  158. 0 : blk_rq_sectors(rq);
  159. __entry->bytes = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
  160. blk_rq_bytes(rq) : 0;
  161. blk_fill_rwbs(__entry->rwbs, req_op(rq), rq->cmd_flags,
  162. blk_rq_bytes(rq));
  163. blk_dump_cmd(__get_str(cmd), rq);
  164. memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
  165. ),
  166. TP_printk("%d,%d %s %u (%s) %llu + %u [%s]",
  167. MAJOR(__entry->dev), MINOR(__entry->dev),
  168. __entry->rwbs, __entry->bytes, __get_str(cmd),
  169. (unsigned long long)__entry->sector,
  170. __entry->nr_sector, __entry->comm)
  171. );
  172. /**
  173. * block_rq_insert - insert block operation request into queue
  174. * @q: target queue
  175. * @rq: block IO operation request
  176. *
  177. * Called immediately before block operation request @rq is inserted
  178. * into queue @q. The fields in the operation request @rq struct can
  179. * be examined to determine which device and sectors the pending
  180. * operation would access.
  181. */
  182. DEFINE_EVENT(block_rq, block_rq_insert,
  183. TP_PROTO(struct request_queue *q, struct request *rq),
  184. TP_ARGS(q, rq)
  185. );
  186. /**
  187. * block_rq_issue - issue pending block IO request operation to device driver
  188. * @q: queue holding operation
  189. * @rq: block IO operation operation request
  190. *
  191. * Called when block operation request @rq from queue @q is sent to a
  192. * device driver for processing.
  193. */
  194. DEFINE_EVENT(block_rq, block_rq_issue,
  195. TP_PROTO(struct request_queue *q, struct request *rq),
  196. TP_ARGS(q, rq)
  197. );
  198. /**
  199. * block_bio_bounce - used bounce buffer when processing block operation
  200. * @q: queue holding the block operation
  201. * @bio: block operation
  202. *
  203. * A bounce buffer was used to handle the block operation @bio in @q.
  204. * This occurs when hardware limitations prevent a direct transfer of
  205. * data between the @bio data memory area and the IO device. Use of a
  206. * bounce buffer requires extra copying of data and decreases
  207. * performance.
  208. */
  209. TRACE_EVENT(block_bio_bounce,
  210. TP_PROTO(struct request_queue *q, struct bio *bio),
  211. TP_ARGS(q, bio),
  212. TP_STRUCT__entry(
  213. __field( dev_t, dev )
  214. __field( sector_t, sector )
  215. __field( unsigned int, nr_sector )
  216. __array( char, rwbs, RWBS_LEN )
  217. __array( char, comm, TASK_COMM_LEN )
  218. ),
  219. TP_fast_assign(
  220. __entry->dev = bio->bi_bdev ?
  221. bio->bi_bdev->bd_dev : 0;
  222. __entry->sector = bio->bi_iter.bi_sector;
  223. __entry->nr_sector = bio_sectors(bio);
  224. blk_fill_rwbs(__entry->rwbs, bio_op(bio), bio->bi_opf,
  225. bio->bi_iter.bi_size);
  226. memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
  227. ),
  228. TP_printk("%d,%d %s %llu + %u [%s]",
  229. MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
  230. (unsigned long long)__entry->sector,
  231. __entry->nr_sector, __entry->comm)
  232. );
  233. /**
  234. * block_bio_complete - completed all work on the block operation
  235. * @q: queue holding the block operation
  236. * @bio: block operation completed
  237. * @error: io error value
  238. *
  239. * This tracepoint indicates there is no further work to do on this
  240. * block IO operation @bio.
  241. */
  242. TRACE_EVENT(block_bio_complete,
  243. TP_PROTO(struct request_queue *q, struct bio *bio, int error),
  244. TP_ARGS(q, bio, error),
  245. TP_STRUCT__entry(
  246. __field( dev_t, dev )
  247. __field( sector_t, sector )
  248. __field( unsigned, nr_sector )
  249. __field( int, error )
  250. __array( char, rwbs, RWBS_LEN)
  251. ),
  252. TP_fast_assign(
  253. __entry->dev = bio->bi_bdev->bd_dev;
  254. __entry->sector = bio->bi_iter.bi_sector;
  255. __entry->nr_sector = bio_sectors(bio);
  256. __entry->error = error;
  257. blk_fill_rwbs(__entry->rwbs, bio_op(bio), bio->bi_opf,
  258. bio->bi_iter.bi_size);
  259. ),
  260. TP_printk("%d,%d %s %llu + %u [%d]",
  261. MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
  262. (unsigned long long)__entry->sector,
  263. __entry->nr_sector, __entry->error)
  264. );
  265. DECLARE_EVENT_CLASS(block_bio_merge,
  266. TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
  267. TP_ARGS(q, rq, bio),
  268. TP_STRUCT__entry(
  269. __field( dev_t, dev )
  270. __field( sector_t, sector )
  271. __field( unsigned int, nr_sector )
  272. __array( char, rwbs, RWBS_LEN )
  273. __array( char, comm, TASK_COMM_LEN )
  274. ),
  275. TP_fast_assign(
  276. __entry->dev = bio->bi_bdev->bd_dev;
  277. __entry->sector = bio->bi_iter.bi_sector;
  278. __entry->nr_sector = bio_sectors(bio);
  279. blk_fill_rwbs(__entry->rwbs, bio_op(bio), bio->bi_opf,
  280. bio->bi_iter.bi_size);
  281. memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
  282. ),
  283. TP_printk("%d,%d %s %llu + %u [%s]",
  284. MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
  285. (unsigned long long)__entry->sector,
  286. __entry->nr_sector, __entry->comm)
  287. );
  288. /**
  289. * block_bio_backmerge - merging block operation to the end of an existing operation
  290. * @q: queue holding operation
  291. * @rq: request bio is being merged into
  292. * @bio: new block operation to merge
  293. *
  294. * Merging block request @bio to the end of an existing block request
  295. * in queue @q.
  296. */
  297. DEFINE_EVENT(block_bio_merge, block_bio_backmerge,
  298. TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
  299. TP_ARGS(q, rq, bio)
  300. );
  301. /**
  302. * block_bio_frontmerge - merging block operation to the beginning of an existing operation
  303. * @q: queue holding operation
  304. * @rq: request bio is being merged into
  305. * @bio: new block operation to merge
  306. *
  307. * Merging block IO operation @bio to the beginning of an existing block
  308. * operation in queue @q.
  309. */
  310. DEFINE_EVENT(block_bio_merge, block_bio_frontmerge,
  311. TP_PROTO(struct request_queue *q, struct request *rq, struct bio *bio),
  312. TP_ARGS(q, rq, bio)
  313. );
  314. /**
  315. * block_bio_queue - putting new block IO operation in queue
  316. * @q: queue holding operation
  317. * @bio: new block operation
  318. *
  319. * About to place the block IO operation @bio into queue @q.
  320. */
  321. TRACE_EVENT(block_bio_queue,
  322. TP_PROTO(struct request_queue *q, struct bio *bio),
  323. TP_ARGS(q, bio),
  324. TP_STRUCT__entry(
  325. __field( dev_t, dev )
  326. __field( sector_t, sector )
  327. __field( unsigned int, nr_sector )
  328. __array( char, rwbs, RWBS_LEN )
  329. __array( char, comm, TASK_COMM_LEN )
  330. ),
  331. TP_fast_assign(
  332. __entry->dev = bio->bi_bdev->bd_dev;
  333. __entry->sector = bio->bi_iter.bi_sector;
  334. __entry->nr_sector = bio_sectors(bio);
  335. blk_fill_rwbs(__entry->rwbs, bio_op(bio), bio->bi_opf,
  336. bio->bi_iter.bi_size);
  337. memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
  338. ),
  339. TP_printk("%d,%d %s %llu + %u [%s]",
  340. MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
  341. (unsigned long long)__entry->sector,
  342. __entry->nr_sector, __entry->comm)
  343. );
  344. DECLARE_EVENT_CLASS(block_get_rq,
  345. TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
  346. TP_ARGS(q, bio, rw),
  347. TP_STRUCT__entry(
  348. __field( dev_t, dev )
  349. __field( sector_t, sector )
  350. __field( unsigned int, nr_sector )
  351. __array( char, rwbs, RWBS_LEN )
  352. __array( char, comm, TASK_COMM_LEN )
  353. ),
  354. TP_fast_assign(
  355. __entry->dev = bio ? bio->bi_bdev->bd_dev : 0;
  356. __entry->sector = bio ? bio->bi_iter.bi_sector : 0;
  357. __entry->nr_sector = bio ? bio_sectors(bio) : 0;
  358. blk_fill_rwbs(__entry->rwbs, bio ? bio_op(bio) : 0,
  359. bio ? bio->bi_opf : 0, __entry->nr_sector);
  360. memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
  361. ),
  362. TP_printk("%d,%d %s %llu + %u [%s]",
  363. MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
  364. (unsigned long long)__entry->sector,
  365. __entry->nr_sector, __entry->comm)
  366. );
  367. /**
  368. * block_getrq - get a free request entry in queue for block IO operations
  369. * @q: queue for operations
  370. * @bio: pending block IO operation
  371. * @rw: low bit indicates a read (%0) or a write (%1)
  372. *
  373. * A request struct for queue @q has been allocated to handle the
  374. * block IO operation @bio.
  375. */
  376. DEFINE_EVENT(block_get_rq, block_getrq,
  377. TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
  378. TP_ARGS(q, bio, rw)
  379. );
  380. /**
  381. * block_sleeprq - waiting to get a free request entry in queue for block IO operation
  382. * @q: queue for operation
  383. * @bio: pending block IO operation
  384. * @rw: low bit indicates a read (%0) or a write (%1)
  385. *
  386. * In the case where a request struct cannot be provided for queue @q
  387. * the process needs to wait for an request struct to become
  388. * available. This tracepoint event is generated each time the
  389. * process goes to sleep waiting for request struct become available.
  390. */
  391. DEFINE_EVENT(block_get_rq, block_sleeprq,
  392. TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
  393. TP_ARGS(q, bio, rw)
  394. );
  395. /**
  396. * block_plug - keep operations requests in request queue
  397. * @q: request queue to plug
  398. *
  399. * Plug the request queue @q. Do not allow block operation requests
  400. * to be sent to the device driver. Instead, accumulate requests in
  401. * the queue to improve throughput performance of the block device.
  402. */
  403. TRACE_EVENT(block_plug,
  404. TP_PROTO(struct request_queue *q),
  405. TP_ARGS(q),
  406. TP_STRUCT__entry(
  407. __array( char, comm, TASK_COMM_LEN )
  408. ),
  409. TP_fast_assign(
  410. memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
  411. ),
  412. TP_printk("[%s]", __entry->comm)
  413. );
  414. DECLARE_EVENT_CLASS(block_unplug,
  415. TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit),
  416. TP_ARGS(q, depth, explicit),
  417. TP_STRUCT__entry(
  418. __field( int, nr_rq )
  419. __array( char, comm, TASK_COMM_LEN )
  420. ),
  421. TP_fast_assign(
  422. __entry->nr_rq = depth;
  423. memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
  424. ),
  425. TP_printk("[%s] %d", __entry->comm, __entry->nr_rq)
  426. );
  427. /**
  428. * block_unplug - release of operations requests in request queue
  429. * @q: request queue to unplug
  430. * @depth: number of requests just added to the queue
  431. * @explicit: whether this was an explicit unplug, or one from schedule()
  432. *
  433. * Unplug request queue @q because device driver is scheduled to work
  434. * on elements in the request queue.
  435. */
  436. DEFINE_EVENT(block_unplug, block_unplug,
  437. TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit),
  438. TP_ARGS(q, depth, explicit)
  439. );
  440. /**
  441. * block_split - split a single bio struct into two bio structs
  442. * @q: queue containing the bio
  443. * @bio: block operation being split
  444. * @new_sector: The starting sector for the new bio
  445. *
  446. * The bio request @bio in request queue @q needs to be split into two
  447. * bio requests. The newly created @bio request starts at
  448. * @new_sector. This split may be required due to hardware limitation
  449. * such as operation crossing device boundaries in a RAID system.
  450. */
  451. TRACE_EVENT(block_split,
  452. TP_PROTO(struct request_queue *q, struct bio *bio,
  453. unsigned int new_sector),
  454. TP_ARGS(q, bio, new_sector),
  455. TP_STRUCT__entry(
  456. __field( dev_t, dev )
  457. __field( sector_t, sector )
  458. __field( sector_t, new_sector )
  459. __array( char, rwbs, RWBS_LEN )
  460. __array( char, comm, TASK_COMM_LEN )
  461. ),
  462. TP_fast_assign(
  463. __entry->dev = bio->bi_bdev->bd_dev;
  464. __entry->sector = bio->bi_iter.bi_sector;
  465. __entry->new_sector = new_sector;
  466. blk_fill_rwbs(__entry->rwbs, bio_op(bio), bio->bi_opf,
  467. bio->bi_iter.bi_size);
  468. memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
  469. ),
  470. TP_printk("%d,%d %s %llu / %llu [%s]",
  471. MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
  472. (unsigned long long)__entry->sector,
  473. (unsigned long long)__entry->new_sector,
  474. __entry->comm)
  475. );
  476. /**
  477. * block_bio_remap - map request for a logical device to the raw device
  478. * @q: queue holding the operation
  479. * @bio: revised operation
  480. * @dev: device for the operation
  481. * @from: original sector for the operation
  482. *
  483. * An operation for a logical device has been mapped to the
  484. * raw block device.
  485. */
  486. TRACE_EVENT(block_bio_remap,
  487. TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev,
  488. sector_t from),
  489. TP_ARGS(q, bio, dev, from),
  490. TP_STRUCT__entry(
  491. __field( dev_t, dev )
  492. __field( sector_t, sector )
  493. __field( unsigned int, nr_sector )
  494. __field( dev_t, old_dev )
  495. __field( sector_t, old_sector )
  496. __array( char, rwbs, RWBS_LEN)
  497. ),
  498. TP_fast_assign(
  499. __entry->dev = bio->bi_bdev->bd_dev;
  500. __entry->sector = bio->bi_iter.bi_sector;
  501. __entry->nr_sector = bio_sectors(bio);
  502. __entry->old_dev = dev;
  503. __entry->old_sector = from;
  504. blk_fill_rwbs(__entry->rwbs, bio_op(bio), bio->bi_opf,
  505. bio->bi_iter.bi_size);
  506. ),
  507. TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
  508. MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
  509. (unsigned long long)__entry->sector,
  510. __entry->nr_sector,
  511. MAJOR(__entry->old_dev), MINOR(__entry->old_dev),
  512. (unsigned long long)__entry->old_sector)
  513. );
  514. /**
  515. * block_rq_remap - map request for a block operation request
  516. * @q: queue holding the operation
  517. * @rq: block IO operation request
  518. * @dev: device for the operation
  519. * @from: original sector for the operation
  520. *
  521. * The block operation request @rq in @q has been remapped. The block
  522. * operation request @rq holds the current information and @from hold
  523. * the original sector.
  524. */
  525. TRACE_EVENT(block_rq_remap,
  526. TP_PROTO(struct request_queue *q, struct request *rq, dev_t dev,
  527. sector_t from),
  528. TP_ARGS(q, rq, dev, from),
  529. TP_STRUCT__entry(
  530. __field( dev_t, dev )
  531. __field( sector_t, sector )
  532. __field( unsigned int, nr_sector )
  533. __field( dev_t, old_dev )
  534. __field( sector_t, old_sector )
  535. __field( unsigned int, nr_bios )
  536. __array( char, rwbs, RWBS_LEN)
  537. ),
  538. TP_fast_assign(
  539. __entry->dev = disk_devt(rq->rq_disk);
  540. __entry->sector = blk_rq_pos(rq);
  541. __entry->nr_sector = blk_rq_sectors(rq);
  542. __entry->old_dev = dev;
  543. __entry->old_sector = from;
  544. __entry->nr_bios = blk_rq_count_bios(rq);
  545. blk_fill_rwbs(__entry->rwbs, req_op(rq), rq->cmd_flags,
  546. blk_rq_bytes(rq));
  547. ),
  548. TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu %u",
  549. MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
  550. (unsigned long long)__entry->sector,
  551. __entry->nr_sector,
  552. MAJOR(__entry->old_dev), MINOR(__entry->old_dev),
  553. (unsigned long long)__entry->old_sector, __entry->nr_bios)
  554. );
  555. #endif /* _TRACE_BLOCK_H */
  556. /* This part must be outside protection */
  557. #include <trace/define_trace.h>