X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=blktrace.c;h=deb8b2d6d68eb465b1929fd9565cde900d9b408c;hp=2d4dc1b9fbca3724e47c7285e7fcdab277b82bc3;hb=2a2804c95571c5bc9f3fc9e6e5b422fa90aa5670;hpb=26e616d054f238bf6b7ada351e17b72fdfbbb8e0 diff --git a/blktrace.c b/blktrace.c index 2d4dc1b9..deb8b2d6 100644 --- a/blktrace.c +++ b/blktrace.c @@ -11,7 +11,7 @@ #include "flist.h" #include "fio.h" #include "blktrace_api.h" -#include "lib/linux-dev-lookup.h" +#include "oslib/linux-dev-lookup.h" #define TRACE_FIFO_SIZE 8192 @@ -208,6 +208,23 @@ out: return last_fileno; } +static void t_bytes_align(struct thread_options *o, struct blk_io_trace *t) +{ + if (!o->replay_align) + return; + + t->bytes = (t->bytes + o->replay_align - 1) & ~(o->replay_align - 1); +} + +static void ipo_bytes_align(struct thread_options *o, struct io_piece *ipo) +{ + if (!o->replay_align) + return; + + ipo->offset &= ~(o->replay_align - 1); +} + + /* * Store blk_io_trace data in an ipo for later retrieval. */ @@ -220,6 +237,9 @@ static void store_ipo(struct thread_data *td, unsigned long long offset, init_ipo(ipo); ipo->offset = offset * bs; + if (td->o.replay_scale) + ipo->offset = ipo->offset / td->o.replay_scale; + ipo_bytes_align(&td->o, ipo); ipo->len = bytes; ipo->delay = ttime / 1000; if (rw) @@ -275,6 +295,9 @@ static void handle_trace_discard(struct thread_data *td, INIT_FLIST_HEAD(&ipo->list); ipo->offset = t->sector * bs; + if (td->o.replay_scale) + ipo->offset = ipo->offset / td->o.replay_scale; + ipo_bytes_align(&td->o, ipo); ipo->len = t->bytes; ipo->delay = ttime / 1000; ipo->ddir = DDIR_TRIM; @@ -314,7 +337,7 @@ static void handle_trace(struct thread_data *td, struct blk_io_trace *t, unsigned long *ios, unsigned int *bs) { static unsigned long long last_ttime; - unsigned long long delay; + unsigned long long delay = 0; if ((t->action & 0xffff) != __BLK_TA_QUEUE) return; @@ -329,6 +352,8 @@ static void handle_trace(struct thread_data *td, struct blk_io_trace *t, } } + t_bytes_align(&td->o, t); + if (t->action & BLK_TC_ACT(BLK_TC_NOTIFY)) handle_trace_notify(t); else if (t->action & BLK_TC_ACT(BLK_TC_DISCARD))