Skip to content

Commit

Permalink
blktrace: correct remap names
Browse files Browse the repository at this point in the history
This attempts to clarify names utilized during block I/O remap
operations (partition, volume manager). It correctly matches up the
/from/ information for both device & sector. This takes in the concept
from Kosaki Motohiro and extends it to include better naming for the
"device_from" field.

[ Impact: cleanup ]

Signed-off-by: Alan D. Brunelle <[email protected]>
Reviewed-by: Li Zefan <[email protected]>
Reviewed-by: KOSAKI Motohiro <[email protected]>
Cc: Jens Axboe <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Alan D. Brunelle authored and Ingo Molnar committed May 6, 2009
1 parent de1d728 commit a42aaa3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions include/linux/blktrace_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ struct blk_io_trace {
* The remap event
*/
struct blk_io_trace_remap {
__be32 device;
__be32 device_from;
__be64 sector;
__be32 device_to;
__be64 sector_from;
};

enum {
Expand Down
4 changes: 2 additions & 2 deletions include/trace/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ DECLARE_TRACE(block_split,

DECLARE_TRACE(block_remap,
TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev,
sector_t from, sector_t to),
TP_ARGS(q, bio, dev, from, to));
sector_t to, sector_t from),
TP_ARGS(q, bio, dev, to, from));

#endif
24 changes: 12 additions & 12 deletions kernel/trace/blktrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -830,26 +830,26 @@ static void blk_add_trace_split(struct request_queue *q, struct bio *bio,
* @q: queue the io is for
* @bio: the source bio
* @dev: target device
* @from: source sector
* @to: target sector
* @from: source sector
*
* Description:
* Device mapper or raid target sometimes need to split a bio because
* it spans a stripe (or similar). Add a trace for that action.
*
**/
static void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
dev_t dev, sector_t from, sector_t to)
dev_t dev, sector_t to, sector_t from)
{
struct blk_trace *bt = q->blk_trace;
struct blk_io_trace_remap r;

if (likely(!bt))
return;

r.device = cpu_to_be32(dev);
r.device_from = cpu_to_be32(bio->bi_bdev->bd_dev);
r.sector = cpu_to_be64(to);
r.device_from = cpu_to_be32(dev);
r.device_to = cpu_to_be32(bio->bi_bdev->bd_dev);
r.sector_from = cpu_to_be64(from);

__blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP,
!bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r);
Expand Down Expand Up @@ -1028,11 +1028,11 @@ static void get_pdu_remap(const struct trace_entry *ent,
struct blk_io_trace_remap *r)
{
const struct blk_io_trace_remap *__r = pdu_start(ent);
__u64 sector = __r->sector;
__u64 sector_from = __r->sector_from;

r->device = be32_to_cpu(__r->device);
r->device_from = be32_to_cpu(__r->device_from);
r->sector = be64_to_cpu(sector);
r->device_to = be32_to_cpu(__r->device_to);
r->sector_from = be64_to_cpu(sector_from);
}

typedef int (blk_log_action_t) (struct trace_iterator *iter, const char *act);
Expand Down Expand Up @@ -1148,13 +1148,13 @@ static int blk_log_with_error(struct trace_seq *s,

static int blk_log_remap(struct trace_seq *s, const struct trace_entry *ent)
{
struct blk_io_trace_remap r = { .device = 0, };
struct blk_io_trace_remap r = { .device_from = 0, };

get_pdu_remap(ent, &r);
return trace_seq_printf(s, "%llu + %u <- (%d,%d) %llu\n",
t_sector(ent),
t_sec(ent), MAJOR(r.device), MINOR(r.device),
(unsigned long long)r.sector);
t_sector(ent), t_sec(ent),
MAJOR(r.device_from), MINOR(r.device_from),
(unsigned long long)r.sector_from);
}

static int blk_log_plug(struct trace_seq *s, const struct trace_entry *ent)
Expand Down

0 comments on commit a42aaa3

Please sign in to comment.