blktrace support now works
authorJens Axboe <jens.axboe@oracle.com>
Tue, 15 May 2007 11:10:41 +0000 (13:10 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 15 May 2007 11:10:41 +0000 (13:10 +0200)
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>
blktrace.c

index 3f0938f22fa00f696b0963937e3ffd1ec74e25f3..864e9dc7900bf4971fcc70dc7720a0b89be7b42e 100644 (file)
@@ -64,7 +64,10 @@ static void store_ipo(struct thread_data *td, unsigned long long offset,
 
        memset(ipo, 0, sizeof(*ipo));
        INIT_LIST_HEAD(&ipo->list);
 
        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)
        ipo->len = bytes;
        ipo->delay = ttime / 1000;
        if (rw)
@@ -86,6 +89,14 @@ static void handle_trace(struct thread_data *td, struct blk_io_trace *t,
 
        if ((t->action & 0xffff) != __BLK_TA_QUEUE)
                return;
 
        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]++;
 
        rw = (t->action & BLK_TC_ACT(BLK_TC_WRITE)) != 0;
        ios[rw]++;