Make I/O priority option generic for non-Linux environment [2/2]
[fio.git] / options.c
index 1b6ce25caa0f9b7ea1363d266166c2e1f963802a..4723e414c68ccd1e4b83500c95c9ca87c9a81b48 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1678,7 +1678,6 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .help   = "Number of IO buffers to submit in one go",
                .parent = "iodepth",
                .hide   = 1,
-               .minval = 1,
                .interval = 1,
                .def    = "1",
                .category = FIO_OPT_C_IO,
@@ -2162,7 +2161,14 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                          },
                },
        },
-#endif /* CONFIG_POSIX_FALLOCATE */
+#else  /* CONFIG_POSIX_FALLOCATE */
+       {
+               .name   = "fallocate",
+               .lname  = "Fallocate",
+               .type   = FIO_OPT_UNSUPPORTED,
+               .help   = "Your platform does not support fallocate",
+       },
+#endif /* CONFIG_POSIX_FALLOCATE */
        {
                .name   = "fadvise_hint",
                .lname  = "Fadvise hint",
@@ -2183,6 +2189,13 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .category = FIO_OPT_C_FILE,
                .group  = FIO_OPT_G_INVALID,
        },
+#else
+       {
+               .name   = "fadvise_stream",
+               .lname  = "Fadvise stream",
+               .type   = FIO_OPT_UNSUPPORTED,
+               .help   = "Your platform does not support fadvise stream ID",
+       },
 #endif
        {
                .name   = "fsync",
@@ -2246,6 +2259,13 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .category = FIO_OPT_C_FILE,
                .group  = FIO_OPT_G_INVALID,
        },
+#else
+       {
+               .name   = "sync_file_range",
+               .lname  = "Sync file range",
+               .type   = FIO_OPT_UNSUPPORTED,
+               .help   = "Your platform does not support sync_file_range",
+       },
 #endif
        {
                .name   = "direct",
@@ -2677,6 +2697,13 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .category = FIO_OPT_C_IO,
                .group  = FIO_OPT_G_VERIFY,
        },
+#else
+       {
+               .name   = "verify_async_cpus",
+               .lname  = "Async verify CPUs",
+               .type   = FIO_OPT_UNSUPPORTED,
+               .help   = "Your platform does not support CPU affinities",
+       },
 #endif
        {
                .name   = "experimental_verify",
@@ -2761,6 +2788,31 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .category = FIO_OPT_C_IO,
                .group  = FIO_OPT_G_TRIM,
        },
+#else
+       {
+               .name   = "trim_percentage",
+               .lname  = "Trim percentage",
+               .type   = FIO_OPT_UNSUPPORTED,
+               .help   = "Fio does not support TRIM on your platform",
+       },
+       {
+               .name   = "trim_verify_zero",
+               .lname  = "Verify trim zero",
+               .type   = FIO_OPT_UNSUPPORTED,
+               .help   = "Fio does not support TRIM on your platform",
+       },
+       {
+               .name   = "trim_backlog",
+               .lname  = "Trim backlog",
+               .type   = FIO_OPT_UNSUPPORTED,
+               .help   = "Fio does not support TRIM on your platform",
+       },
+       {
+               .name   = "trim_backlog_batch",
+               .lname  = "Trim backlog batch",
+               .type   = FIO_OPT_UNSUPPORTED,
+               .help   = "Fio does not support TRIM on your platform",
+       },
 #endif
        {
                .name   = "write_iolog",
@@ -2853,6 +2905,13 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .category = FIO_OPT_C_FILE,
                .group  = FIO_OPT_G_INVALID,
        },
+#else
+       {
+               .name   = "ioscheduler",
+               .lname  = "I/O scheduler",
+               .type   = FIO_OPT_UNSUPPORTED,
+               .help   = "Your platform does not support IO scheduler switching",
+       },
 #endif
        {
                .name   = "zonesize",
@@ -2953,24 +3012,43 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .type   = FIO_OPT_INT,
                .off1   = td_var_offset(ioprio),
                .help   = "Set job IO priority value",
-               .minval = 0,
-               .maxval = 7,
+               .minval = IOPRIO_MIN_PRIO,
+               .maxval = IOPRIO_MAX_PRIO,
                .interval = 1,
                .category = FIO_OPT_C_GENERAL,
                .group  = FIO_OPT_G_CRED,
        },
+#else
+       {
+               .name   = "prio",
+               .lname  = "I/O nice priority",
+               .type   = FIO_OPT_UNSUPPORTED,
+               .help   = "Your platform does not support IO priorities",
+       },
+#endif
+#ifdef FIO_HAVE_IOPRIO_CLASS
+#ifndef FIO_HAVE_IOPRIO
+#error "FIO_HAVE_IOPRIO_CLASS requires FIO_HAVE_IOPRIO"
+#endif
        {
                .name   = "prioclass",
                .lname  = "I/O nice priority class",
                .type   = FIO_OPT_INT,
                .off1   = td_var_offset(ioprio_class),
                .help   = "Set job IO priority class",
-               .minval = 0,
-               .maxval = 3,
+               .minval = IOPRIO_MIN_PRIO_CLASS,
+               .maxval = IOPRIO_MAX_PRIO_CLASS,
                .interval = 1,
                .category = FIO_OPT_C_GENERAL,
                .group  = FIO_OPT_G_CRED,
        },
+#else
+       {
+               .name   = "prioclass",
+               .lname  = "I/O nice priority class",
+               .type   = FIO_OPT_UNSUPPORTED,
+               .help   = "Your platform does not support IO priority classes",
+       },
 #endif
        {
                .name   = "thinktime",
@@ -3269,6 +3347,25 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .category = FIO_OPT_C_GENERAL,
                .group  = FIO_OPT_G_CRED,
        },
+#else
+       {
+               .name   = "cpumask",
+               .lname  = "CPU mask",
+               .type   = FIO_OPT_UNSUPPORTED,
+               .help   = "Your platform does not support CPU affinities",
+       },
+       {
+               .name   = "cpus_allowed",
+               .lname  = "CPUs allowed",
+               .type   = FIO_OPT_UNSUPPORTED,
+               .help   = "Your platform does not support CPU affinities",
+       },
+       {
+               .name   = "cpus_allowed_policy",
+               .lname  = "CPUs allowed distribution policy",
+               .type   = FIO_OPT_UNSUPPORTED,
+               .help   = "Your platform does not support CPU affinities",
+       },
 #endif
 #ifdef CONFIG_LIBNUMA
        {
@@ -3291,6 +3388,19 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .category = FIO_OPT_C_GENERAL,
                .group  = FIO_OPT_G_INVALID,
        },
+#else
+       {
+               .name   = "numa_cpu_nodes",
+               .lname  = "NUMA CPU Nodes",
+               .type   = FIO_OPT_UNSUPPORTED,
+               .help   = "Build fio with libnuma-dev(el) to enable this option",
+       },
+       {
+               .name   = "numa_mem_policy",
+               .lname  = "NUMA Memory Policy",
+               .type   = FIO_OPT_UNSUPPORTED,
+               .help   = "Build fio with libnuma-dev(el) to enable this option",
+       },
 #endif
        {
                .name   = "end_fsync",
@@ -3463,6 +3573,13 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .category = FIO_OPT_C_LOG,
                .group  = FIO_OPT_G_INVALID,
        },
+#else
+       {
+               .name   = "log_compression_cpus",
+               .lname  = "Log Compression CPUs",
+               .type   = FIO_OPT_UNSUPPORTED,
+               .help   = "Your platform does not support CPU affinities",
+       },
 #endif
        {
                .name   = "log_store_compressed",
@@ -3473,6 +3590,19 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .category = FIO_OPT_C_LOG,
                .group  = FIO_OPT_G_INVALID,
        },
+#else
+       {
+               .name   = "log_compression",
+               .lname  = "Log compression",
+               .type   = FIO_OPT_UNSUPPORTED,
+               .help   = "Install libz-dev(el) to get compression support",
+       },
+       {
+               .name   = "log_store_compressed",
+               .lname  = "Log store compressed",
+               .type   = FIO_OPT_UNSUPPORTED,
+               .help   = "Install libz-dev(el) to get compression support",
+       },
 #endif
        {
                .name   = "block_error_percentiles",
@@ -3633,6 +3763,13 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .category = FIO_OPT_C_STAT,
                .group  = FIO_OPT_G_INVALID,
        },
+#else
+       {
+               .name   = "disk_util",
+               .lname  = "Disk utilization",
+               .type   = FIO_OPT_UNSUPPORTED,
+               .help   = "Your platform does not support disk utilization",
+       },
 #endif
        {
                .name   = "gtod_reduce",
@@ -4278,7 +4415,8 @@ static void show_closest_option(const char *opt)
                i++;
        }
 
-       if (best_option != -1 && string_distance_ok(name, best_distance))
+       if (best_option != -1 && string_distance_ok(name, best_distance) &&
+           fio_options[best_option].type != FIO_OPT_UNSUPPORTED)
                log_err("Did you mean %s?\n", fio_options[best_option].name);
 
        free(name);