Seperate status timer setup from disk util timer
[fio.git] / options.c
index 8a6a433833582552983ffadf4b2d9e596aa514d5..5aad00501c42b124cf9a7198c45aba5769c9baa2 100644 (file)
--- a/options.c
+++ b/options.c
@@ -6,6 +6,9 @@
 #include <getopt.h>
 #include <assert.h>
 #include <libgen.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
 
 #include "fio.h"
 #include "parse.h"
@@ -178,6 +181,24 @@ static int str_lockmem_cb(void fio_unused *data, unsigned long *val)
        return 0;
 }
 
+static int str_rwmix_read_cb(void *data, unsigned int *val)
+{
+       struct thread_data *td = data;
+
+       td->o.rwmix[DDIR_READ] = *val;
+       td->o.rwmix[DDIR_WRITE] = 100 - *val;
+       return 0;
+}
+
+static int str_rwmix_write_cb(void *data, unsigned int *val)
+{
+       struct thread_data *td = data;
+
+       td->o.rwmix[DDIR_WRITE] = *val;
+       td->o.rwmix[DDIR_READ] = 100 - *val;
+       return 0;
+}
+
 #ifdef FIO_HAVE_IOPRIO
 static int str_prioclass_cb(void *data, unsigned int *val)
 {
@@ -273,17 +294,24 @@ static int str_fst_cb(void *data, const char *str)
 static int check_dir(struct thread_data *td, char *fname)
 {
        char file[PATH_MAX], *dir;
-       struct stat sb;
        int elen = 0;
 
        if (td->o.directory) {
                strcpy(file, td->o.directory);
+               strcat(file, "/");
                elen = strlen(file);
        }
 
-       sprintf(file + elen, "/%s", fname);
+       sprintf(file + elen, "%s", fname);
        dir = dirname(file);
 
+#if 0
+       {
+       struct stat sb;
+       /*
+        * We can't do this on FIO_DISKLESSIO engines. The engine isn't loaded
+        * yet, so we can't do this check right here...
+        */
        if (lstat(dir, &sb) < 0) {
                int ret = errno;
 
@@ -296,6 +324,8 @@ static int check_dir(struct thread_data *td, char *fname)
                log_err("fio: %s is not a directory\n", dir);
                return 1;
        }
+       }
+#endif
 
        return 0;
 }
@@ -973,7 +1003,7 @@ static struct fio_option options[] = {
        {
                .name   = "rwmixread",
                .type   = FIO_OPT_INT,
-               .off1   = td_var_offset(rwmix[DDIR_READ]),
+               .cb     = str_rwmix_read_cb,
                .maxval = 100,
                .help   = "Percentage of mixed workload that is reads",
                .def    = "50",
@@ -981,7 +1011,7 @@ static struct fio_option options[] = {
        {
                .name   = "rwmixwrite",
                .type   = FIO_OPT_INT,
-               .off1   = td_var_offset(rwmix[DDIR_WRITE]),
+               .cb     = str_rwmix_write_cb,
                .maxval = 100,
                .help   = "Percentage of mixed workload that is writes",
                .def    = "50",
@@ -1215,6 +1245,12 @@ static struct fio_option options[] = {
                .off1   = td_var_offset(zero_buffers),
                .help   = "Init IO buffers to all zeroes",
        },
+       {
+               .name   = "refill_buffers",
+               .type   = FIO_OPT_STR_SET,
+               .off1   = td_var_offset(refill_buffers),
+               .help   = "Refill IO buffers on every IO submit",
+       },
 #ifdef FIO_HAVE_DISK_UTIL
        {
                .name   = "disk_util",
@@ -1242,7 +1278,7 @@ void fio_options_dup_and_init(struct option *long_options)
 
        o = &options[0];
        while (o->name) {
-               long_options[i].name = o->name;
+               long_options[i].name = (char *) o->name;
                long_options[i].val = FIO_GETOPT_JOB;
                if (o->type == FIO_OPT_STR_SET)
                        long_options[i].has_arg = no_argument;