From: Jens Axboe Date: Sat, 10 Feb 2007 18:01:57 +0000 (+0100) Subject: [PATCH] Random map fix X-Git-Tag: fio-1.12~110 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=afdbe580a4c173cb90b079dc266229c6d4257911 [PATCH] Random map fix mark_random_map() would give up too soon, causing an infinite loop in the block allocation. Reported by Randy Dunlap. Signed-off-by: Jens Axboe --- diff --git a/io_u.c b/io_u.c index ebfa0d45..31f75cd6 100644 --- a/io_u.c +++ b/io_u.c @@ -27,13 +27,13 @@ static int random_map_free(struct thread_data *td, struct fio_file *f, static void mark_random_map(struct thread_data *td, struct fio_file *f, struct io_u *io_u) { - unsigned int min_bs = td->min_bs[io_u->ddir]; + unsigned int min_bs = td->rw_min_bs; unsigned long long block; unsigned int blocks; block = io_u->offset / (unsigned long long) min_bs; blocks = 0; - while (blocks < (io_u->buflen / min_bs)) { + while (blocks < ((io_u->buflen + min_bs - 1) / min_bs)) { unsigned int idx, bit; if (!random_map_free(td, f, block))