Make options mask a 64-bit type
[fio.git] / options.c
index 4798fbfe919d14afedba9e0bb6ece70043c557ba..8494713977a215dd9c22110b15edb83cbfd38b85 100644 (file)
--- a/options.c
+++ b/options.c
@@ -204,7 +204,8 @@ static int str_bssplit_cb(void *data, const char *input)
                        ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
                        free(op);
                }
-               ret = bssplit_ddir(&td->o, DDIR_READ, str);
+               if (!ret)
+                       ret = bssplit_ddir(&td->o, DDIR_READ, str);
        }
 
        free(p);
@@ -351,7 +352,8 @@ static int str_mem_cb(void *data, const char *mem)
 {
        struct thread_data *td = data;
 
-       if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
+       if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP ||
+           td->o.mem_type == MEM_MMAPSHARED)
                td->o.mmapfile = get_opt_postfix(mem);
 
        return 0;
@@ -528,9 +530,25 @@ static int str_verify_cpus_allowed_cb(void *data, const char *input)
 {
        struct thread_data *td = data;
 
+       if (parse_dryrun())
+               return 0;
+
        return set_cpus_allowed(td, &td->o.verify_cpumask, input);
 }
-#endif
+
+#ifdef CONFIG_ZLIB
+static int str_log_cpus_allowed_cb(void *data, const char *input)
+{
+       struct thread_data *td = data;
+
+       if (parse_dryrun())
+               return 0;
+
+       return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
+}
+#endif /* CONFIG_ZLIB */
+
+#endif /* FIO_HAVE_CPU_AFFINITY */
 
 #ifdef CONFIG_LIBNUMA
 static int str_numa_cpunodes_cb(void *data, char *input)
@@ -1057,8 +1075,9 @@ static struct opt_group fio_opt_groups[] = {
        },
 };
 
-static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
-                                              unsigned int inv_mask)
+static struct opt_group *__opt_group_from_mask(struct opt_group *ogs,
+                                              uint64_t *mask,
+                                              uint64_t inv_mask)
 {
        struct opt_group *og;
        int i;
@@ -1078,7 +1097,7 @@ static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned i
        return NULL;
 }
 
-struct opt_group *opt_group_from_mask(unsigned int *mask)
+struct opt_group *opt_group_from_mask(uint64_t *mask)
 {
        return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
 }
@@ -1182,7 +1201,7 @@ static struct opt_group fio_opt_cat_groups[] = {
        }
 };
 
-struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
+struct opt_group *opt_group_cat_from_mask(uint64_t *mask)
 {
        return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
 }
@@ -1504,11 +1523,12 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .group  = FIO_OPT_G_IO_BASIC,
        },
        {
-               .name   = "iodepth_batch_complete",
-               .lname  = "IO Depth batch complete",
+               .name   = "iodepth_batch_complete_min",
+               .lname  = "Min IO depth batch complete",
+               .alias  = "iodepth_batch_complete",
                .type   = FIO_OPT_INT,
-               .off1   = td_var_offset(iodepth_batch_complete),
-               .help   = "Number of IO buffers to retrieve in one go",
+               .off1   = td_var_offset(iodepth_batch_complete_min),
+               .help   = "Min number of IO buffers to retrieve in one go",
                .parent = "iodepth",
                .hide   = 1,
                .minval = 0,
@@ -1517,6 +1537,19 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .category = FIO_OPT_C_IO,
                .group  = FIO_OPT_G_IO_BASIC,
        },
+       {
+               .name   = "iodepth_batch_complete_max",
+               .lname  = "Max IO depth batch complete",
+               .type   = FIO_OPT_INT,
+               .off1   = td_var_offset(iodepth_batch_complete_max),
+               .help   = "Max number of IO buffers to retrieve in one go",
+               .parent = "iodepth",
+               .hide   = 1,
+               .minval = 0,
+               .interval = 1,
+               .category = FIO_OPT_C_IO,
+               .group  = FIO_OPT_G_IO_BASIC,
+       },
        {
                .name   = "iodepth_low",
                .lname  = "IO Depth batch low",
@@ -2214,6 +2247,10 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                            .oval = MEM_MMAP,
                            .help = "Use mmap(2) (file or anon) for IO buffers",
                          },
+                         { .ival = "mmapshared",
+                           .oval = MEM_MMAPSHARED,
+                           .help = "Like mmap, but use the shared flag",
+                         },
 #ifdef FIO_HAVE_HUGETLB
                          { .ival = "mmaphuge",
                            .oval = MEM_MMAPHUGE,
@@ -2799,7 +2836,8 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .group  = FIO_OPT_G_RATE,
        },
        {
-               .name   = "ratemin",
+               .name   = "rate_min",
+               .alias  = "ratemin",
                .lname  = "I/O min rate",
                .type   = FIO_OPT_INT,
                .off1   = td_var_offset(ratemin[DDIR_READ]),
@@ -2837,7 +2875,30 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .group  = FIO_OPT_G_RATE,
        },
        {
-               .name   = "ratecycle",
+               .name   = "rate_process",
+               .lname  = "Rate Process",
+               .type   = FIO_OPT_STR,
+               .off1   = td_var_offset(rate_process),
+               .help   = "What process controls how rated IO is managed",
+               .def    = "linear",
+               .category = FIO_OPT_C_IO,
+               .group  = FIO_OPT_G_RATE,
+               .posval = {
+                         { .ival = "linear",
+                           .oval = RATE_PROCESS_LINEAR,
+                           .help = "Linear rate of IO",
+                         },
+                         {
+                           .ival = "poisson",
+                           .oval = RATE_PROCESS_POISSON,
+                           .help = "Rate follows Poisson process",
+                         },
+               },
+               .parent = "rate",
+       },
+       {
+               .name   = "rate_cycle",
+               .alias  = "ratecycle",
                .lname  = "I/O rate cycle",
                .type   = FIO_OPT_INT,
                .off1   = td_var_offset(ratecycle),
@@ -3082,6 +3143,15 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .category = FIO_OPT_C_GENERAL,
                .group  = FIO_OPT_G_PROCESS,
        },
+       {
+               .name   = "exitall_on_error",
+               .lname  = "Exit-all on terminate in error",
+               .type   = FIO_OPT_BOOL,
+               .off1   = td_var_offset(unlink),
+               .help   = "Terminate all jobs when one exits in error",
+               .category = FIO_OPT_C_GENERAL,
+               .group  = FIO_OPT_G_PROCESS,
+       },
        {
                .name   = "stonewall",
                .lname  = "Wait for previous",
@@ -3177,11 +3247,24 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .type   = FIO_OPT_INT,
                .off1   = td_var_offset(log_gz),
                .help   = "Log in compressed chunks of this size",
-               .minval = 32 * 1024 * 1024ULL,
+               .minval = 1024ULL,
                .maxval = 512 * 1024 * 1024ULL,
                .category = FIO_OPT_C_LOG,
                .group  = FIO_OPT_G_INVALID,
        },
+#ifdef FIO_HAVE_CPU_AFFINITY
+       {
+               .name   = "log_compression_cpus",
+               .lname  = "Log Compression CPUs",
+               .type   = FIO_OPT_STR,
+               .cb     = str_log_cpus_allowed_cb,
+               .off1   = td_var_offset(log_gz_cpumask),
+               .parent = "log_compression",
+               .help   = "Limit log compression to these CPUs",
+               .category = FIO_OPT_C_LOG,
+               .group  = FIO_OPT_G_INVALID,
+       },
+#endif
        {
                .name   = "log_store_compressed",
                .lname  = "Log store compressed",
@@ -3999,8 +4082,7 @@ static void show_closest_option(const char *opt)
        free(name);
 }
 
-int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
-                       int dump_cmdline)
+int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
 {
        int i, ret, unknown;
        char **opts_copy;
@@ -4011,7 +4093,7 @@ int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
        for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
                struct fio_option *o;
                int newret = parse_option(opts_copy[i], opts[i], fio_options,
-                                               &o, td, dump_cmdline);
+                                               &o, td, &td->opt_list);
 
                if (!newret && o)
                        fio_option_mark_set(&td->o, o);
@@ -4044,7 +4126,7 @@ int fio_options_parse(struct thread_data *td, char **opts, int num_opts,
                        if (td->eo)
                                newret = parse_option(opts_copy[i], opts[i],
                                                      td->io_ops->options, &o,
-                                                     td->eo, dump_cmdline);
+                                                     td->eo, &td->opt_list);
 
                        ret |= newret;
                        if (!o) {
@@ -4064,7 +4146,7 @@ int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
 {
        int ret;
 
-       ret = parse_cmd_option(opt, val, fio_options, td);
+       ret = parse_cmd_option(opt, val, fio_options, td, &td->opt_list);
        if (!ret) {
                struct fio_option *o;
 
@@ -4079,7 +4161,8 @@ int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
                                char *val)
 {
-       return parse_cmd_option(opt, val, td->io_ops->options, td->eo);
+       return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
+                                       &td->opt_list);
 }
 
 void fio_fill_default_options(struct thread_data *td)
@@ -4268,19 +4351,19 @@ static int opt_is_set(struct thread_options *o, struct fio_option *opt)
        return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
 }
 
-int __fio_option_is_set(struct thread_options *o, unsigned int off1)
+bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
 {
        struct fio_option *opt, *next;
 
        next = NULL;
        while ((opt = find_next_opt(o, next, off1)) != NULL) {
                if (opt_is_set(o, opt))
-                       return 1;
+                       return true;
 
                next = opt;
        }
 
-       return 0;
+       return false;
 }
 
 void fio_option_mark_set(struct thread_options *o, struct fio_option *opt)