X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=blktrace.c;h=988ce5917cd564f13aadd00402501e7f6713385a;hp=178a2a35eb57b4ac7d47b8a1acd6dd81e4154f75;hb=fdefd987d7ba284c7a9e101911c4b8e72fe326ad;hpb=fb7b71a3c99b7ead2055439bfea421579aae2691 diff --git a/blktrace.c b/blktrace.c index 178a2a35..988ce591 100644 --- a/blktrace.c +++ b/blktrace.c @@ -46,8 +46,32 @@ int is_blktrace(const char *filename) 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)