blktrace support now works

One little buglet - the blktrace offset is the sector, not the
byte offset. For now it's hardcoded at 512, should really get
the value from the device.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/blktrace.c b/blktrace.c
index 3f0938f..864e9dc 100644
--- a/blktrace.c
+++ b/blktrace.c
@@ -64,7 +64,10 @@
 
 	memset(ipo, 0, sizeof(*ipo));
 	INIT_LIST_HEAD(&ipo->list);
-	ipo->offset = offset;
+	/*
+	 * the 512 is wrong here, it should be the hardware sector size...
+	 */
+	ipo->offset = offset * 512;
 	ipo->len = bytes;
 	ipo->delay = ttime / 1000;
 	if (rw)
@@ -86,6 +89,14 @@
 
 	if ((t->action & 0xffff) != __BLK_TA_QUEUE)
 		return;
+	if (t->action & BLK_TC_ACT(BLK_TC_PC))
+		return;
+
+	/*
+	 * should not happen, need to look into that...
+	 */
+	if (!t->bytes)
+		return;
 
 	rw = (t->action & BLK_TC_ACT(BLK_TC_WRITE)) != 0;
 	ios[rw]++;