It is valid to use size=foo, where foo is larger than the size
of the file or device. For that case, we don't want offsets
larger than the size of the file. So use the minimum of the
real or given size.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
{
unsigned int range_size, seed;
unsigned long nranges;
+ uint64_t file_size;
range_size = min(td->o.min_bs[DDIR_READ], td->o.min_bs[DDIR_WRITE]);
+ file_size = min(f->real_file_size, f->io_size);
- nranges = (f->io_size + range_size - 1) / range_size;
+ nranges = (file_size + range_size - 1) / range_size;
seed = jhash(f->file_name, strlen(f->file_name), 0) * td->thread_number;
if (!td->o.rand_repeatable)