Add option to disable fadvise() hints
[fio.git] / options.c
index e13b2b241342092b0d60b5c7b499fed4e85a0582..4f30f2c1991aaf8769e2802d4dceef7cb0d83a34 100644 (file)
--- a/options.c
+++ b/options.c
@@ -27,6 +27,18 @@ static char *get_opt_postfix(const char *str)
        return strdup(p);
 }
 
+static int str_rw_cb(void *data, const char *str)
+{
+       struct thread_data *td = data;
+       char *nr = get_opt_postfix(str);
+
+       td->o.ddir_nr = 0;
+       if (nr)
+               td->o.ddir_nr = atoi(nr);
+
+       return 0;
+}
+
 static int str_mem_cb(void *data, const char *mem)
 {
        struct thread_data *td = data;
@@ -203,6 +215,7 @@ static struct fio_option options[] = {
                .name   = "rw",
                .alias  = "readwrite",
                .type   = FIO_OPT_STR,
+               .cb     = str_rw_cb,
                .off1   = td_var_offset(td_ddir),
                .help   = "IO direction",
                .def    = "read",
@@ -233,6 +246,13 @@ static struct fio_option options[] = {
                          },
                },
        },
+       {
+               .name   = "fadvise_hint",
+               .type   = FIO_OPT_BOOL,
+               .off1   = td_var_offset(fadvise_hint),
+               .help   = "Use fadvise() to advise the kernel on IO pattern",
+               .def    = "1",
+       },
        {
                .name   = "ioengine",
                .type   = FIO_OPT_STR_STORE,