Fix overlap io_u into outside regions
authorJens Axboe <jaxboe@fusionio.com>
Tue, 24 May 2011 09:26:16 +0000 (11:26 +0200)
committerJens Axboe <jaxboe@fusionio.com>
Tue, 24 May 2011 09:26:16 +0000 (11:26 +0200)
commit799441286648bdced4f42d3040f37fd2e35eaf1d
tree0ee2da1e51a50c752dc629da6702a1beb2aa1c05
parent76a3179ec3b849e4d4b0324ab3f517beec816bdf
Fix overlap io_u into outside regions

Test case is a job file ala this:

[global]
ioengine=posixaio
direct=0
filename=testfile
iodepth=128
size=50M
loops=10000000000
group_reporting=1
readwrite=randwrite
do_verify=1
verify=md5
verify_fatal=1
numjobs=1
thread
bsrange=4k:1M

[thread0]
offset=0G

[thread1]
offset=50M

[thread2]
offset=100M

[thread3]
offset=150M

[thread4]
offset=200M

[thread5]
offset=250M

[thread6]
offset=300M

[thread7]
offset=350M

where io_u units from threadN ends up crossing into the zone of threadN+1.
This is due to using file->real_file_size as the boundary check for the
buffer length, where the offset itself is correctly calculated. When
using mixed block sizes, this can cause a blocksize larger than the
minimum size to span into the next region.

Fix this by using file->io_size + offset as the end delimeter. Also
improve the logic of dropping to a smaller allowed block size if we do
end up being close to spanning into the next region.

Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
io_u.c