From 888677a428eb6ae6b54195e99734d6d6b3ee55e7 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 10 Apr 2013 22:19:46 +0200 Subject: [PATCH] Merge in zipf differences from gfio Signed-off-by: Jens Axboe --- filesetup.c | 8 ++++---- options.c | 4 ++-- thread_options.h | 5 +++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/filesetup.c b/filesetup.c index 88d6565a..9edcac17 100644 --- a/filesetup.c +++ b/filesetup.c @@ -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; } diff --git a/options.c b/options.c index fd91eede..e30aacc9 100644 --- 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; diff --git a/thread_options.h b/thread_options.h index d64423fe..70048033 100644 --- a/thread_options.h +++ b/thread_options.h @@ -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; -- 2.25.1