Merge in zipf differences from gfio
authorJens Axboe <axboe@kernel.dk>
Wed, 10 Apr 2013 20:19:46 +0000 (22:19 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 10 Apr 2013 20:19:46 +0000 (22:19 +0200)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
filesetup.c
options.c
thread_options.h

index 88d6565afca65335ea88627f810862385a15da94..9edcac17a822301093d0cbab9068b65e0936857e 100644 (file)
@@ -97,9 +97,9 @@ static int extend_file(struct thread_data *td, struct fio_file *f)
 
                        r = fallocate(f->fd, FALLOC_FL_KEEP_SIZE, 0,
                                        f->real_file_size);
-                       if (r != 0) {
+                       if (r != 0)
                                td_verror(td, errno, "fallocate");
-                       }
+
                        break;
 #endif /* CONFIG_LINUX_FALLOCATE */
                default:
@@ -918,9 +918,9 @@ static int __init_rand_distribution(struct thread_data *td, struct fio_file *f)
                seed = td->rand_seeds[4];
 
        if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
-               zipf_init(&f->zipf, nranges, td->o.zipf_theta, seed);
+               zipf_init(&f->zipf, nranges, td->o.zipf_theta.u.f, seed);
        else
-               pareto_init(&f->zipf, nranges, td->o.pareto_h, seed);
+               pareto_init(&f->zipf, nranges, td->o.pareto_h.u.f, seed);
 
        return 1;
 }
index fd91eede7a2ae8a90fe78d59284627235fbecb7e..e30aacc939d7e0fb0ecb001e91b07a4ab093dd87 100644 (file)
--- a/options.c
+++ b/options.c
@@ -735,13 +735,13 @@ static int str_random_distribution_cb(void *data, const char *str)
                        log_err("fio: zipf theta must different than 1.0\n");
                        return 1;
                }
-               td->o.zipf_theta = val;
+               td->o.zipf_theta.u.f = val;
        } else {
                if (val <= 0.00 || val >= 1.00) {
                        log_err("fio: pareto input out of range (0 < input < 1.0)\n");
                        return 1;
                }
-               td->o.pareto_h = val;
+               td->o.pareto_h.u.f = val;
        }
 
        return 0;
index d64423fe3a21f8817c9e42c09ef0675e732c3ac8..700480337bfe8705ae613b169ec372213565925c 100644 (file)
@@ -5,6 +5,7 @@
 #include "os/os.h"
 #include "stat.h"
 #include "gettime.h"
+#include "lib/ieee754.h"
 
 /*
  * What type of allocation to use for io buffers
@@ -125,8 +126,8 @@ struct thread_options {
        unsigned int fsync_on_close;
 
        unsigned int random_distribution;
-       double zipf_theta;
-       double pareto_h;
+       fio_fp64_t zipf_theta;
+       fio_fp64_t pareto_h;
 
        unsigned int random_generator;