filesetup: add native fallocate
[fio.git] / options.c
index 09a21af0f441d8ea67bb30a9b05075109f3a6a9a..b21f09ae169a2287c70adadc6e931f9bd52042c1 100644 (file)
--- a/options.c
+++ b/options.c
@@ -2289,14 +2289,14 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .parent = "nrfiles",
                .hide   = 1,
        },
                .parent = "nrfiles",
                .hide   = 1,
        },
-#ifdef CONFIG_POSIX_FALLOCATE
+#if defined(CONFIG_POSIX_FALLOCATE) || defined(FIO_HAVE_NATIVE_FALLOCATE)
        {
                .name   = "fallocate",
                .lname  = "Fallocate",
                .type   = FIO_OPT_STR,
                .off1   = offsetof(struct thread_options, fallocate_mode),
                .help   = "Whether pre-allocation is performed when laying out files",
        {
                .name   = "fallocate",
                .lname  = "Fallocate",
                .type   = FIO_OPT_STR,
                .off1   = offsetof(struct thread_options, fallocate_mode),
                .help   = "Whether pre-allocation is performed when laying out files",
-               .def    = "posix",
+               .def    = "native",
                .category = FIO_OPT_C_FILE,
                .group  = FIO_OPT_G_INVALID,
                .posval = {
                .category = FIO_OPT_C_FILE,
                .group  = FIO_OPT_G_INVALID,
                .posval = {
@@ -2304,10 +2304,16 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                            .oval = FIO_FALLOCATE_NONE,
                            .help = "Do not pre-allocate space",
                          },
                            .oval = FIO_FALLOCATE_NONE,
                            .help = "Do not pre-allocate space",
                          },
+                         { .ival = "native",
+                           .oval = FIO_FALLOCATE_NATIVE,
+                           .help = "Use native pre-allocation if possible",
+                         },
+#ifdef CONFIG_POSIX_FALLOCATE
                          { .ival = "posix",
                            .oval = FIO_FALLOCATE_POSIX,
                            .help = "Use posix_fallocate()",
                          },
                          { .ival = "posix",
                            .oval = FIO_FALLOCATE_POSIX,
                            .help = "Use posix_fallocate()",
                          },
+#endif
 #ifdef CONFIG_LINUX_FALLOCATE
                          { .ival = "keep",
                            .oval = FIO_FALLOCATE_KEEP_SIZE,
 #ifdef CONFIG_LINUX_FALLOCATE
                          { .ival = "keep",
                            .oval = FIO_FALLOCATE_KEEP_SIZE,
@@ -2319,10 +2325,12 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                            .oval = FIO_FALLOCATE_NONE,
                            .help = "Alias for 'none'",
                          },
                            .oval = FIO_FALLOCATE_NONE,
                            .help = "Alias for 'none'",
                          },
+#ifdef CONFIG_POSIX_FALLOCATE
                          { .ival = "1",
                            .oval = FIO_FALLOCATE_POSIX,
                            .help = "Alias for 'posix'",
                          },
                          { .ival = "1",
                            .oval = FIO_FALLOCATE_POSIX,
                            .help = "Alias for 'posix'",
                          },
+#endif
                },
        },
 #else  /* CONFIG_POSIX_FALLOCATE */
                },
        },
 #else  /* CONFIG_POSIX_FALLOCATE */
@@ -2332,7 +2340,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .type   = FIO_OPT_UNSUPPORTED,
                .help   = "Your platform does not support fallocate",
        },
                .type   = FIO_OPT_UNSUPPORTED,
                .help   = "Your platform does not support fallocate",
        },
-#endif /* CONFIG_POSIX_FALLOCATE */
+#endif /* CONFIG_POSIX_FALLOCATE || FIO_HAVE_NATIVE_FALLOCATE */
        {
                .name   = "fadvise_hint",
                .lname  = "Fadvise hint",
        {
                .name   = "fadvise_hint",
                .lname  = "Fadvise hint",