From: Jens Axboe Date: Thu, 31 Jan 2008 12:25:42 +0000 (+0100) Subject: Fix wrong accouning of zone bytes X-Git-Tag: fio-1.17.3~2 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=d9d91e39df9cdc02d17c7b6831e2408ed1faa432 Fix wrong accouning of zone bytes Ryan Thomas 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 --- diff --git a/io_u.c b/io_u.c index 7890a870..8201ccde 100644 --- a/io_u.c +++ b/io_u.c @@ -375,6 +375,7 @@ static int fill_io_u(struct thread_data *td, struct io_u *io_u) * If using a write iolog, store this entry. */ out: + td->zone_bytes += io_u->buflen; log_io_u(td, io_u); return 0; } @@ -765,7 +766,6 @@ static void io_completed(struct thread_data *td, struct io_u *io_u, td->io_blocks[idx]++; td->io_bytes[idx] += bytes; - td->zone_bytes += bytes; td->this_io_bytes[idx] += bytes; io_u->file->last_completed_pos = io_u->endpos;