unsigned int bytes, int rw, unsigned long long ttime,
int fileno, unsigned int bs)
{
- struct io_piece *ipo = malloc(sizeof(*ipo));
+ struct io_piece *ipo;
+ ipo = calloc(1, sizeof(*ipo));
init_ipo(ipo);
ipo->offset = offset * bs;
unsigned long long ttime,
unsigned long *ios, unsigned int *rw_bs)
{
- struct io_piece *ipo = malloc(sizeof(*ipo));
+ struct io_piece *ipo;
unsigned int bs;
int fileno;
+ if (td->o.replay_skip & (1u << DDIR_TRIM))
+ return;
+
+ ipo = calloc(1, sizeof(*ipo));
init_ipo(ipo);
fileno = trace_add_file(td, t->device, &bs);
rw = (t->action & BLK_TC_ACT(BLK_TC_WRITE)) != 0;
- /*
- * Need to figure out why 0 byte writes end up here sometimes, for
- * now just ignore them.
- */
- if (!t->bytes)
- return;
- else if (t->bytes > rw_bs[rw])
+ if (rw) {
+ if (td->o.replay_skip & (1u << DDIR_WRITE))
+ return;
+ } else {
+ if (td->o.replay_skip & (1u << DDIR_READ))
+ return;
+ }
+
+ assert(t->bytes);
+
+ if (t->bytes > rw_bs[rw])
rw_bs[rw] = t->bytes;
ios[rw]++;
store_ipo(td, t->sector, t->bytes, rw, ttime, fileno, bs);
}
+static void handle_trace_flush(struct thread_data *td, struct blk_io_trace *t,
+ unsigned long long ttime)
+{
+ struct io_piece *ipo;
+ unsigned int bs;
+ int fileno;
+
+ if (td->o.replay_skip & (1u << DDIR_SYNC))
+ return;
+
+ ipo = calloc(1, sizeof(*ipo));
+ init_ipo(ipo);
+ fileno = trace_add_file(td, t->device, &bs);
+
+ ipo->delay = ttime / 1000;
+ ipo->ddir = DDIR_SYNC;
+ ipo->fileno = fileno;
+
+ dprint(FD_BLKTRACE, "store flush delay=%lu\n", ipo->delay);
+ queue_io_piece(td, ipo);
+}
+
/*
* We only care for queue traces, most of the others are side effects
* due to internal workings of the block layer.
handle_trace_notify(t);
else if (t->action & BLK_TC_ACT(BLK_TC_DISCARD))
handle_trace_discard(td, t, delay, ios, bs);
+ else if (t->action & BLK_TC_ACT(BLK_TC_FLUSH))
+ handle_trace_flush(td, t, delay);
else
handle_trace_fs(td, t, delay, ios, bs);
}