X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=filesetup.c;h=41809093ffd92b8eac8f5b2e5e89f16facfab12a;hp=be2eba52e38936a74224267c18eb26b7d1303f7c;hb=21415db9f1689a5c47fda5e710879c4739707442;hpb=0303a2613762c630083c4bf7418f7e08c1d552a5 diff --git a/filesetup.c b/filesetup.c index be2eba52..41809093 100644 --- a/filesetup.c +++ b/filesetup.c @@ -907,10 +907,12 @@ static int __init_rand_distribution(struct thread_data *td, struct fio_file *f) { 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)