Merge branch 'esx-timerfd-bypass' of https://github.com/brianredbeard/fio
[fio.git] / filesetup.c
index d382fa24195331c10c2b1cf015ee3007524f7853..9d0337578d2266355b8ff478c5153cff88c26d77 100644 (file)
@@ -231,13 +231,12 @@ static int extend_file(struct thread_data *td, struct fio_file *f)
                                                break;
                                        log_info("fio: ENOSPC on laying out "
                                                 "file, stopping\n");
-                                       break;
                                }
                                td_verror(td, errno, "write");
                        } else
                                td_verror(td, EIO, "write");
 
-                       break;
+                       goto err;
                }
        }
 
@@ -655,8 +654,7 @@ int generic_open_file(struct thread_data *td, struct fio_file *f)
                }
                flags |= OS_O_DIRECT | FIO_O_ATOMIC;
        }
-       if (td->o.sync_io)
-               flags |= O_SYNC;
+       flags |= td->o.sync_io;
        if (td->o.create_on_open && td->o.allow_create)
                flags |= O_CREAT;
 skip_flags:
@@ -817,7 +815,7 @@ static unsigned long long get_fs_free_counts(struct thread_data *td)
                } else if (f->filetype != FIO_TYPE_FILE)
                        continue;
 
-               snprintf(buf, ARRAY_SIZE(buf), "%s", f->file_name);
+               snprintf(buf, FIO_ARRAY_SIZE(buf), "%s", f->file_name);
 
                if (stat(buf, &sb) < 0) {
                        if (errno != ENOENT)
@@ -840,7 +838,7 @@ static unsigned long long get_fs_free_counts(struct thread_data *td)
                        continue;
 
                fm = calloc(1, sizeof(*fm));
-               snprintf(fm->__base, ARRAY_SIZE(fm->__base), "%s", buf);
+               snprintf(fm->__base, FIO_ARRAY_SIZE(fm->__base), "%s", buf);
                fm->base = basename(fm->__base);
                fm->key = sb.st_dev;
                flist_add(&fm->list, &list);
@@ -1139,6 +1137,8 @@ int setup_files(struct thread_data *td)
                if (f->io_size == -1ULL)
                        total_size = -1ULL;
                else {
+                       uint64_t io_size;
+
                         if (o->size_percent && o->size_percent != 100) {
                                uint64_t file_size;
 
@@ -1150,7 +1150,14 @@ int setup_files(struct thread_data *td)
 
                                f->io_size -= (f->io_size % td_min_bs(td));
                        }
-                       total_size += f->io_size;
+
+                       io_size = f->io_size;
+                       if (o->io_size_percent && o->io_size_percent != 100) {
+                               io_size *= o->io_size_percent;
+                               io_size /= 100;
+                       }
+
+                       total_size += io_size;
                }
 
                if (f->filetype == FIO_TYPE_FILE &&
@@ -1192,7 +1199,7 @@ int setup_files(struct thread_data *td)
                o->size = total_size;
 
        if (o->size < td_min_bs(td)) {
-               log_err("fio: blocksize too large for data set\n");
+               log_err("fio: blocksize is larger than data set range\n");
                goto err_out;
        }
 
@@ -1312,11 +1319,11 @@ static void __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.u.f, seed);
+               zipf_init(&f->zipf, nranges, td->o.zipf_theta.u.f, td->o.random_center.u.f, seed);
        else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
-               pareto_init(&f->zipf, nranges, td->o.pareto_h.u.f, seed);
+               pareto_init(&f->zipf, nranges, td->o.pareto_h.u.f, td->o.random_center.u.f, seed);
        else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
-               gauss_init(&f->gauss, nranges, td->o.gauss_dev.u.f, seed);
+               gauss_init(&f->gauss, nranges, td->o.gauss_dev.u.f, td->o.random_center.u.f, seed);
 }
 
 static bool init_rand_distribution(struct thread_data *td)