X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=init.c;h=1ba8fe6e5b08f359d92f582ff10b51099d3ef46e;hp=c9bf78f6223f00f36ab7c410f46f269464979db3;hb=9258468e828cfe1c31b977635994003fe388398e;hpb=5bba8b3acee1bf1359470a82cac030942018405a diff --git a/init.c b/init.c index c9bf78f6..1ba8fe6e 100644 --- a/init.c +++ b/init.c @@ -564,6 +564,24 @@ static unsigned long long get_rand_start_delay(struct thread_data *td) return delayrange; } +static unsigned int gcd(unsigned int m, unsigned int n) +{ + unsigned int r; + + if (!m || !n) + return 0; + + do { + r = m % n; + if (!r) + break; + m = n; + n = r; + } while (1); + + return n; +} + /* * Lazy way of fixing up options that depend on each other. We could also * define option callback handlers, but this is easier. @@ -739,6 +757,15 @@ static int fixup_options(struct thread_data *td) o->verify_interval = o->min_bs[DDIR_WRITE]; else if (td_read(td) && o->verify_interval > o->min_bs[DDIR_READ]) o->verify_interval = o->min_bs[DDIR_READ]; + + /* + * Verify interval must be a factor or both min and max + * write size + */ + if (o->verify_interval % o->min_bs[DDIR_WRITE] || + o->verify_interval % o->max_bs[DDIR_WRITE]) + o->verify_interval = gcd(o->min_bs[DDIR_WRITE], + o->max_bs[DDIR_WRITE]); } if (o->pre_read) {