+ ipo->fileno = fileno;
+
+ dprint(FD_BLKTRACE, "store ddir=%d, off=%llu, len=%lu, delay=%lu\n",
+ ipo->ddir, ipo->offset,
+ ipo->len, ipo->delay);
+ queue_io_piece(td, ipo);
+}
+
+static void handle_trace_notify(struct blk_io_trace *t)
+{
+ switch (t->action) {
+ case BLK_TN_PROCESS:
+ printf("got process notify: %x, %d\n", t->action, t->pid);
+ break;
+ case BLK_TN_TIMESTAMP:
+ printf("got timestamp notify: %x, %d\n", t->action, t->pid);
+ break;
+ case BLK_TN_MESSAGE:
+ break;
+ default:
+ dprint(FD_BLKTRACE, "unknown trace act %x\n", t->action);
+ break;
+ }
+}
+
+static void handle_trace_discard(struct thread_data *td, struct blk_io_trace *t,
+ unsigned long long ttime, unsigned long *ios)
+{
+ struct io_piece *ipo = malloc(sizeof(*ipo));
+ int fileno;
+
+ init_ipo(ipo);
+ fileno = trace_add_file(td, t->device);
+
+ ios[DDIR_WRITE]++;
+ td->o.size += t->bytes;
+
+ memset(ipo, 0, sizeof(*ipo));
+ INIT_FLIST_HEAD(&ipo->list);
+
+ /*
+ * the 512 is wrong here, it should be the hardware sector size...
+ */
+ ipo->offset = t->sector * 512;
+ ipo->len = t->bytes;
+ ipo->delay = ttime / 1000;
+ ipo->ddir = DDIR_TRIM;
+ ipo->fileno = fileno;
+
+ dprint(FD_BLKTRACE, "store discard, off=%llu, len=%lu, delay=%lu\n",
+ ipo->offset, ipo->len,
+ ipo->delay);
+ queue_io_piece(td, ipo);
+}
+
+static void handle_trace_fs(struct thread_data *td, struct blk_io_trace *t,
+ unsigned long long ttime, unsigned long *ios,
+ unsigned int *bs)
+{
+ int rw;
+ int fileno;
+
+ fileno = trace_add_file(td, t->device);
+
+ rw = (t->action & BLK_TC_ACT(BLK_TC_WRITE)) != 0;