Merge branch 'master' into gfio
[fio.git] / filesetup.c
index c96c2502a46bdec4494d2141cd5a2078a75d2014..ee58a7b63333728a8a3e392b21e7f202ddecb6f5 100644 (file)
@@ -13,7 +13,7 @@
 #include "filehash.h"
 #include "os/os.h"
 #include "hash.h"
-#include "lib/bitmap.h"
+#include "lib/axmap.h"
 
 #ifdef FIO_HAVE_LINUX_FALLOCATE
 #include <linux/falloc.h>
@@ -96,9 +96,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 /* FIO_HAVE_LINUX_FALLOCATE */
                default:
@@ -878,9 +878,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;
 }
@@ -911,14 +911,20 @@ int init_random_map(struct thread_data *td)
 
        if (init_rand_distribution(td))
                return 0;
-       if (td->o.norandommap || !td_random(td))
+       if (!td_random(td))
                return 0;
 
        for_each_file(td, f, i) {
                blocks = (f->real_file_size + td->o.rw_min_bs - 1) /
                                (unsigned long long) td->o.rw_min_bs;
-               f->io_bitmap = bitmap_new(blocks);
-               if (f->io_bitmap)
+               if (td->o.random_generator == FIO_RAND_GEN_LFSR) {
+                       if (!lfsr_init(&f->lfsr, blocks))
+                               continue;
+               } else if (!td->o.norandommap) {
+                       f->io_axmap = axmap_new(blocks);
+                       if (f->io_axmap)
+                               continue;
+               } else if (td->o.norandommap)
                        continue;
 
                if (!td->o.softrandommap) {
@@ -967,8 +973,8 @@ void close_and_free_files(struct thread_data *td)
 
                sfree(f->file_name);
                f->file_name = NULL;
-               bitmap_free(f->io_bitmap);
-               f->io_bitmap = NULL;
+               axmap_free(f->io_axmap);
+               f->io_axmap = NULL;
                sfree(f);
        }