Fix wrong accouning of zone bytes
authorJens Axboe <jens.axboe@oracle.com>
Thu, 31 Jan 2008 12:25:42 +0000 (13:25 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Thu, 31 Jan 2008 12:25:42 +0000 (13:25 +0100)
commitd9d91e39df9cdc02d17c7b6831e2408ed1faa432
tree815b9e5a612de610493cbd816793a386083453ef
parent65bdb10a09222d8b5d213de74824be775772ea8f
Fix wrong accouning of zone bytes

Ryan Thomas <Ryan.Thomas@nuance.com> writes:

**********

With the following job description

[global]
bs=1k
direct=1
rw=read
ioengine=libaio
iodepth=2
zonesize=1k
zoneskip=1023k
write_bw_log

[/dev/cciss/c0d1]
write_iolog=foo2

The idea here is that I wanted to line up my zones to start at 1M
boundaries across the disk by writing 1k and skipping the next 1023k.
In practice I don't get the alignment because of an extra initial I/O.
I get an iolog that looks like

fio version 2 iolog
/dev/cciss/c0d1 add
/dev/cciss/c0d1 open
/dev/cciss/c0d1 read 0 1024
/dev/cciss/c0d1 read 1024 1024
/dev/cciss/c0d1 read 1049600 1024
/dev/cciss/c0d1 read 2098176 1024

There's a read that I don't expect in that log, namely the read starting
at byte 1024.  Because that read is there, the disk zones get offset by
one block.  I expected output like

fio version 2 iolog
/dev/cciss/c0d1 add
/dev/cciss/c0d1 open
/dev/cciss/c0d1 read 0 1024
/dev/cciss/c0d1 read 1048576 1024
/dev/cciss/c0d1 read 2097152 1024
/dev/cciss/c0d1 read 3145728 1024

***********

The problem is due to the fact that fio account zone_bytes when the IO
completes, which is clearly not correct for io depth > 1. So move the
accounting to when we fill the io_u instead.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
io_u.c