Some more bits of blktrace support

Basic read/write is there. Still need to extract device name from
the trace, and check time delays to wait appropriately.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/blktrace.c b/blktrace.c
index 178a2a3..988ce59 100644
--- a/blktrace.c
+++ b/blktrace.c
@@ -46,8 +46,32 @@
 	return 0;
 }
 
+static void store_ipo(struct thread_data *td, unsigned long long offset,
+		      unsigned int bytes, int rw)
+{
+	struct io_piece *ipo = malloc(sizeof(*ipo));
+
+	memset(ipo, 0, sizeof(*ipo));
+	INIT_LIST_HEAD(&ipo->list);
+	ipo->offset = offset;
+	ipo->len = bytes;
+	if (rw)
+		ipo->ddir = DDIR_WRITE;
+	else
+		ipo->ddir = DDIR_READ;
+
+	list_add_tail(&ipo->list, &td->io_log_list);
+}
+
 static void handle_trace(struct thread_data *td, struct blk_io_trace *t)
 {
+	int rw;
+
+	if ((t->action & 0xffff) != __BLK_TA_QUEUE)
+		return;
+
+	w = (t->action & BLK_TC_ACT(BLK_TC_WRITE)) != 0;
+	store_ipo(td, t->sector, t->bytes, rw);
 }
 
 int load_blktrace(struct thread_data *td, const char *filename)