Add specific knob for controlling fallocate() usage
[fio.git] / options.c
index cb6337c27207664b80ac7acd81156ade8687519b..1c07982d41cf23497862289d814b294a6e1edcb8 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1081,6 +1081,15 @@ static struct fio_option options[] = {
                },
                .parent = "nrfiles",
        },
+#ifdef FIO_HAVE_FALLOCATE
+       {
+               .name   = "fallocate",
+               .type   = FIO_OPT_BOOL,
+               .off1   = td_var_offset(fallocate),
+               .help   = "Use fallocate() when laying out files",
+               .def    = "1",
+       },
+#endif
        {
                .name   = "fadvise_hint",
                .type   = FIO_OPT_BOOL,
@@ -1726,13 +1735,6 @@ static struct fio_option options[] = {
                },
                .help   = "Select a specific builtin performance test",
        },
-       {
-               .name   = "cgroup_root",
-               .type   = FIO_OPT_STR_STORE,
-               .off1   = td_var_offset(cgroup_root),
-               .help   = "Root of mounted blkio cgroup",
-               .def    = "/cgroup",
-       },
        {
                .name   = "cgroup",
                .type   = FIO_OPT_STR_STORE,
@@ -1746,7 +1748,18 @@ static struct fio_option options[] = {
                .help   = "Use given weight for cgroup",
                .minval = 100,
                .maxval = 1000,
-               .def    = "0",
+       },
+       {
+               .name   = "uid",
+               .type   = FIO_OPT_INT,
+               .off1   = td_var_offset(uid),
+               .help   = "Run job with this user ID",
+       },
+       {
+               .name   = "gid",
+               .type   = FIO_OPT_INT,
+               .off1   = td_var_offset(gid),
+               .help   = "Run job with this group ID",
        },
        {
                .name = NULL,
@@ -1805,16 +1818,15 @@ static struct fio_keyword fio_keywords[] = {
 
 void fio_keywords_init(void)
 {
-       unsigned long mb_memory;
+       unsigned long long mb_memory;
        char buf[128];
        long l;
 
        sprintf(buf, "%lu", page_size);
        fio_keywords[0].replace = strdup(buf);
 
-       l = sysconf(_SC_PHYS_PAGES);
-       mb_memory = l * (page_size / 1024UL);
-       sprintf(buf, "%lu", mb_memory);
+       mb_memory = os_phys_mem() / page_size;
+       sprintf(buf, "%llu", mb_memory);
        fio_keywords[1].replace = strdup(buf);
 
        l = sysconf(_SC_NPROCESSORS_ONLN);