summaryrefslogtreecommitdiff
path: root/blkparse_fmt.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@suse.de>2005-10-06 11:03:20 +0200
committerJens Axboe <axboe@suse.de>2005-10-06 11:03:20 +0200
commita8f30e64d4d3e05fac70a918d175029412cb1ee7 (patch)
tree5f91ffaa5a35fc22bf3ace73746cd2c346bb47ae /blkparse_fmt.c
parent208660b112c49b844c8f7733ab30adc4d278ff36 (diff)
downloadblktrace-a8f30e64d4d3e05fac70a918d175029412cb1ee7.tar.gz
blktrace-a8f30e64d4d3e05fac70a918d175029412cb1ee7.tar.bz2
[PATCH] Add support for remap actions
Diffstat (limited to 'blkparse_fmt.c')
-rw-r--r--blkparse_fmt.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/blkparse_fmt.c b/blkparse_fmt.c
index 30bab91..b8f90de 100644
--- a/blkparse_fmt.c
+++ b/blkparse_fmt.c
@@ -10,7 +10,7 @@
#include "blktrace.h"
-#define VALID_SPECS "BCDFGMPQRSTU"
+#define VALID_SPECS "ABCDFGMPQRSTUWX"
#define HEADER "%D %2c %8s %5T.%9t %5p %2a %3d "
@@ -97,13 +97,23 @@ static char *dump_pdu(unsigned char *pdu_buf, int pdu_len)
return p;
}
+#define pdu_start(t) (((void *) (t) + sizeof(struct blk_io_trace)))
+
static unsigned int get_pdu_int(struct blk_io_trace *t)
{
- __u64 *val = (__u64 *) ((char *) t + sizeof(*t));
+ __u64 *val = pdu_start(t);
return be64_to_cpu(*val);
}
+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);
+
+ r->device = be32_to_cpu(__r->device);
+ r->sector = be64_to_cpu(__r->sector);
+}
+
static void print_field(char *act, struct per_cpu_info *pci,
struct blk_io_trace *t, unsigned long long elapsed,
int pdu_len, unsigned char *pdu_buf, char field,
@@ -294,11 +304,21 @@ static void process_default(char *act, struct per_cpu_info *pci,
break;
case 'U': /* Unplug IO */
- case 'T': { /* Unplug timer */
+ case 'T': /* Unplug timer */
fprintf(ofp, "[%s] %u\n", t->comm, get_pdu_int(t));
break;
- }
+ case 'A': { /* remap */
+ struct blk_io_trace_remap r;
+
+ get_pdu_remap(t, &r);
+ fprintf(ofp, "%llu + %u <- (%d,%d) %llu\n",
+ (unsigned long long) r.sector, t->bytes >> 10,
+ MAJOR(r.device), MINOR(r.device),
+ (unsigned long long) t->sector);
+ break;
+ }
+
case 'X': /* Split */
fprintf(ofp, "%llu / %u [%s]\n", (unsigned long long) t->sector,
get_pdu_int(t), t->comm);