From: Jens Axboe Date: Tue, 15 May 2007 08:12:26 +0000 (+0200) Subject: Some more bits of blktrace support X-Git-Tag: fio-1.16.2~27 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=fdefd987d7ba284c7a9e101911c4b8e72fe326ad 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 --- 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)