block.h 18 KB

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