diff options
author | Roman Pen <r.peniaev@gmail.com> | 2014-03-04 09:13:10 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-03-05 18:11:21 -0500 |
commit | af5040da01ef980670b3741b3e10733ee3e33566 (patch) | |
tree | 213650b561bf15e6b1ae0706ebcca219febc6ab3 /include/trace | |
parent | c46fff2a3b29794b35d717b5680a27f31a6a6bc0 (diff) |
blktrace: fix accounting of partially completed requests
trace_block_rq_complete does not take into account that request can
be partially completed, so we can get the following incorrect output
of blkparser:
C R 232 + 240 [0]
C R 240 + 232 [0]
C R 248 + 224 [0]
C R 256 + 216 [0]
but should be:
C R 232 + 8 [0]
C R 240 + 8 [0]
C R 248 + 8 [0]
C R 256 + 8 [0]
Also, the whole output summary statistics of completed requests and
final throughput will be incorrect.
This patch takes into account real completion size of the request and
fixes wrong completion accounting.
Signed-off-by: Roman Pen <r.peniaev@gmail.com>
CC: Steven Rostedt <rostedt@goodmis.org>
CC: Frederic Weisbecker <fweisbec@gmail.com>
CC: Ingo Molnar <mingo@redhat.com>
CC: linux-kernel@vger.kernel.org
Cc: stable@kernel.org
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'include/trace')
-rw-r--r-- | include/trace/events/block.h | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/include/trace/events/block.h b/include/trace/events/block.h index e76ae19a8d6f..e8a5eca1dbe5 100644 --- a/include/trace/events/block.h +++ b/include/trace/events/block.h | |||
@@ -132,6 +132,7 @@ DEFINE_EVENT(block_rq_with_error, block_rq_requeue, | |||
132 | * block_rq_complete - block IO operation completed by device driver | 132 | * block_rq_complete - block IO operation completed by device driver |
133 | * @q: queue containing the block operation request | 133 | * @q: queue containing the block operation request |
134 | * @rq: block operations request | 134 | * @rq: block operations request |
135 | * @nr_bytes: number of completed bytes | ||
135 | * | 136 | * |
136 | * The block_rq_complete tracepoint event indicates that some portion | 137 | * The block_rq_complete tracepoint event indicates that some portion |
137 | * of operation request has been completed by the device driver. If | 138 | * of operation request has been completed by the device driver. If |
@@ -139,11 +140,37 @@ DEFINE_EVENT(block_rq_with_error, block_rq_requeue, | |||
139 | * do for the request. If @rq->bio is non-NULL then there is | 140 | * do for the request. If @rq->bio is non-NULL then there is |
140 | * additional work required to complete the request. | 141 | * additional work required to complete the request. |
141 | */ | 142 | */ |
142 | DEFINE_EVENT(block_rq_with_error, block_rq_complete, | 143 | TRACE_EVENT(block_rq_complete, |
143 | 144 | ||
144 | TP_PROTO(struct request_queue *q, struct request *rq), | 145 | TP_PROTO(struct request_queue *q, struct request *rq, |
146 | unsigned int nr_bytes), | ||
145 | 147 | ||
146 | TP_ARGS(q, rq) | 148 | TP_ARGS(q, rq, nr_bytes), |
149 | |||
150 | TP_STRUCT__entry( | ||
151 | __field( dev_t, dev ) | ||
152 | __field( sector_t, sector ) | ||
153 | __field( unsigned int, nr_sector ) | ||
154 | __field( int, errors ) | ||
155 | __array( char, rwbs, RWBS_LEN ) | ||
156 | __dynamic_array( char, cmd, blk_cmd_buf_len(rq) ) | ||
157 | ), | ||
158 | |||
159 | TP_fast_assign( | ||
160 | __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; | ||
161 | __entry->sector = blk_rq_pos(rq); | ||
162 | __entry->nr_sector = nr_bytes >> 9; | ||
163 | __entry->errors = rq->errors; | ||
164 | |||
165 | blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, nr_bytes); | ||
166 | blk_dump_cmd(__get_str(cmd), rq); | ||
167 | ), | ||
168 | |||
169 | TP_printk("%d,%d %s (%s) %llu + %u [%d]", | ||
170 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
171 | __entry->rwbs, __get_str(cmd), | ||
172 | (unsigned long long)__entry->sector, | ||
173 | __entry->nr_sector, __entry->errors) | ||
147 | ); | 174 | ); |
148 | 175 | ||
149 | DECLARE_EVENT_CLASS(block_rq, | 176 | DECLARE_EVENT_CLASS(block_rq, |