From: Jens Axboe Date: Mon, 6 Feb 2012 20:58:56 +0000 (+0100) Subject: Fail if we can't satisfy the minimum block size X-Git-Tag: fio-2.0.3~2^2~1 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=52c580272d87d2b9b8a65d317bf7c2d432a30fec Fail if we can't satisfy the minimum block size Commit 799441286648bdced4f42d3040f37fd2e35eaf1d introduced a bug where if we cannot satisfy the minimum block size from a given offset, then we will loop forever trying to do that. Fix that bug checking early if it is indeed a possible thing to satisfy, if not give up. Signed-off-by: Jens Axboe --- diff --git a/io_u.c b/io_u.c index 54f8685b..8a033485 100644 --- a/io_u.c +++ b/io_u.c @@ -377,6 +377,12 @@ static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u) if (minbs == maxbs) return minbs; + /* + * If we can't satisfy the min block size from here, then fail + */ + if (!io_u_fits(td, io_u, minbs)) + return 0; + if (td->o.use_os_rand) rand_max = OS_RAND_MAX; else