Disable random map automatically if a non-uniform random distribution is given
[fio.git] / init.c
diff --git a/init.c b/init.c
index bf4aa03041435a038bd6fd72b636cab10ddd4c9a..70217418ce5f75df75bc88a0cec2d7223a5d7183 100644 (file)
--- a/init.c
+++ b/init.c
@@ -317,6 +317,10 @@ static struct thread_data *get_new_job(int global, struct thread_data *parent,
        profile_add_hooks(td);
 
        td->thread_number = thread_number;
+
+       if (!parent || !parent->o.group_reporting)
+               stat_number++;
+
        return td;
 }
 
@@ -382,24 +386,6 @@ static int fixed_block_size(struct thread_options *o)
                o->min_bs[DDIR_READ] == o->min_bs[DDIR_TRIM];
 }
 
-static void init_rand_distribution(struct thread_data *td)
-{
-       unsigned int range_size;
-       unsigned long nranges;
-
-       if (td->o.random_distribution == FIO_RAND_DIST_RANDOM)
-               return;
-
-       range_size = min(td->o.min_bs[DDIR_READ], td->o.min_bs[DDIR_WRITE]);
-
-       nranges = (td->o.size + range_size - 1) / range_size;
-
-       if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
-               zipf_init(&td->zipf, nranges, td->o.zipf_theta);
-       else
-               pareto_init(&td->zipf, nranges, td->o.pareto_h);
-}
-
 /*
  * Lazy way of fixing up options that depend on each other. We could also
  * define option callback handlers, but this is easier.
@@ -610,7 +596,12 @@ static int fixup_options(struct thread_data *td)
                td->o.compress_percentage = 0;
        }
 
-       init_rand_distribution(td);
+       /*
+        * Using a non-uniform random distribution excludes usage of
+        * a random map
+        */
+       if (td->o.random_distribution != FIO_RAND_DIST_RANDOM)
+               td->o.norandommap = 1;
 
        return ret;
 }