From: Jens Axboe Date: Fri, 23 May 2008 10:37:23 +0000 (+0200) Subject: Work-around too large block count X-Git-Tag: fio-1.21-rc1~8 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=d9dd70f7e3d64ea764f182f152626d895841277c Work-around too large block count Signed-off-by: Jens Axboe --- diff --git a/io_u.c b/io_u.c index ce08c59c..c728168d 100644 --- a/io_u.c +++ b/io_u.c @@ -79,8 +79,16 @@ static inline unsigned long long last_block(struct thread_data *td, enum fio_ddir ddir) { unsigned long long max_blocks; + unsigned long long max_size; - max_blocks = f->io_size / (unsigned long long) td->o.min_bs[ddir]; + /* + * Hmm, should we make sure that ->io_size <= ->real_file_size? + */ + max_size = f->io_size; + if (max_size > f->real_file_size) + max_size = f->real_file_size; + + max_blocks = max_size / (unsigned long long) td->o.min_bs[ddir]; if (!max_blocks) return 0;