summaryrefslogtreecommitdiff
path: root/blkparse_fmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'blkparse_fmt.c')
-rw-r--r--blkparse_fmt.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/blkparse_fmt.c b/blkparse_fmt.c
index 83a8504..ed6cd5c 100644
--- a/blkparse_fmt.c
+++ b/blkparse_fmt.c
@@ -152,11 +152,11 @@ static unsigned int get_pdu_int(struct blk_io_trace *t)
static void get_pdu_remap(struct blk_io_trace *t, struct blk_io_trace_remap *r)
{
struct blk_io_trace_remap *__r = pdu_start(t);
- __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);
}
static void print_field(char *act, struct per_cpu_info *pci,
@@ -284,20 +284,24 @@ static void process_default(char *act, struct per_cpu_info *pci,
struct blk_io_trace *t, unsigned long long elapsed,
int pdu_len, unsigned char *pdu_buf)
{
- struct blk_io_trace_remap r = { .device = 0, };
+ struct blk_io_trace_remap r = { .device_from = 0, };
char rwbs[6];
char *name;
fill_rwbs(rwbs, t);
+ /*
+ * For remaps we have to modify the device using the remap structure
+ * passed up.
+ */
+ if (act[0] == 'A') {
+ get_pdu_remap(t, &r);
+ t->device = r.device_to;
+ }
+
/*
* The header is always the same
*/
- if (act[0] == 'A') { /* Remap */
- get_pdu_remap(t, &r);
- t->device = r.device_from;
- }
-
fprintf(ofp, "%3d,%-3d %2d %8d %5d.%09lu %5u %2s %3s ",
MAJOR(t->device), MINOR(t->device), pci->cpu, t->sequence,
(int) SECONDS(t->time), (unsigned long) NANO_SECONDS(t->time),
@@ -388,10 +392,11 @@ static void process_default(char *act, struct per_cpu_info *pci,
break;
case 'A': /* remap */
+ get_pdu_remap(t, &r);
fprintf(ofp, "%llu + %u <- (%d,%d) %llu\n",
(unsigned long long) t->sector, t_sec(t),
- MAJOR(r.device), MINOR(r.device),
- (unsigned long long) r.sector);
+ MAJOR(r.device_from), MINOR(r.device_from),
+ (unsigned long long) r.sector_from);
break;
case 'X': /* Split */