Add condition to stop issuing io in do_io().
authorJuan Casse <jcasse@chromium.org>
Mon, 16 Sep 2013 16:22:10 +0000 (09:22 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 16 Sep 2013 19:16:25 +0000 (13:16 -0600)
commit20876c53b5d32f2da9049af5e7fb102133946981
tree66a0e8edff970e260297f2b93257dc5cd5ec9dd3
parent03a0825286c82d79b8d489faf33a76d50713474b
Add condition to stop issuing io in do_io().

Problem:
When specifying iodepth > 1 while doing random async io
without a random map (and using the default random generator), the
main while loop in do_io() will issue extra io in the amount of io
allowed to accumulate in the queue. For example, a job with size=24k
and bs=8k will perform 4 io instead of the expected 3.

Reason:
The above behavior occurs because the while loop in do_io()
will continue until the amount of "completed io" >= size, but io
in the queue are not accounted for because they have not been
completed by io_u_queued_complete().

Exceptions:
The above behavior does not manifest itself when:
using random_generator=lfsr bacause lfsr knows when to stop
generating, and get_io_u() inside the while loop returns NULL,
breaking out of the loop.
using random map because random map ensures that all blocks
are hit, and after they are all hit, no more are generated.

Proposed Solution:
Stop while loop based on bytes issued instead of bytes completed.

Signed-off-by: Juan Casse <jcasse@chromium.org>
Reviewed-by: Grant Grundler <grundler@chromium.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
backend.c