mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-19 13:11:14 +00:00
Add a tracepoint for block request remapping
Since 2.6.31 now has request-based device-mapper, it's useful to have a tracepoint for request-remapping as well as bio-remapping. This patch adds a tracepoint for request-remapping, trace_block_rq_remap(). Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com> Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com> Cc: Alasdair G Kergon <agk@redhat.com> Cc: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
This commit is contained in:
parent
67efc92580
commit
b0da3f0dad
4 changed files with 69 additions and 1 deletions
|
@ -855,6 +855,37 @@ static void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
|
|||
sizeof(r), &r);
|
||||
}
|
||||
|
||||
/**
|
||||
* blk_add_trace_rq_remap - Add a trace for a request-remap operation
|
||||
* @q: queue the io is for
|
||||
* @rq: the source request
|
||||
* @dev: target device
|
||||
* @from: source sector
|
||||
*
|
||||
* Description:
|
||||
* Device mapper remaps request to other devices.
|
||||
* Add a trace for that action.
|
||||
*
|
||||
**/
|
||||
static void blk_add_trace_rq_remap(struct request_queue *q,
|
||||
struct request *rq, dev_t dev,
|
||||
sector_t from)
|
||||
{
|
||||
struct blk_trace *bt = q->blk_trace;
|
||||
struct blk_io_trace_remap r;
|
||||
|
||||
if (likely(!bt))
|
||||
return;
|
||||
|
||||
r.device_from = cpu_to_be32(dev);
|
||||
r.device_to = cpu_to_be32(disk_devt(rq->rq_disk));
|
||||
r.sector_from = cpu_to_be64(from);
|
||||
|
||||
__blk_add_trace(bt, blk_rq_pos(rq), blk_rq_bytes(rq),
|
||||
rq_data_dir(rq), BLK_TA_REMAP, !!rq->errors,
|
||||
sizeof(r), &r);
|
||||
}
|
||||
|
||||
/**
|
||||
* blk_add_driver_data - Add binary message with driver-specific data
|
||||
* @q: queue the io is for
|
||||
|
@ -922,10 +953,13 @@ static void blk_register_tracepoints(void)
|
|||
WARN_ON(ret);
|
||||
ret = register_trace_block_remap(blk_add_trace_remap);
|
||||
WARN_ON(ret);
|
||||
ret = register_trace_block_rq_remap(blk_add_trace_rq_remap);
|
||||
WARN_ON(ret);
|
||||
}
|
||||
|
||||
static void blk_unregister_tracepoints(void)
|
||||
{
|
||||
unregister_trace_block_rq_remap(blk_add_trace_rq_remap);
|
||||
unregister_trace_block_remap(blk_add_trace_remap);
|
||||
unregister_trace_block_split(blk_add_trace_split);
|
||||
unregister_trace_block_unplug_io(blk_add_trace_unplug_io);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue