#include <string.h>
#include <getopt.h>
#include <assert.h>
+#include <libgen.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include "fio.h"
#include "parse.h"
-#include "fls.h"
+#include "lib/fls.h"
#define td_var_offset(var) ((size_t) &((struct thread_options *)0)->var)
return 0;
}
+static int str_rwmix_read_cb(void *data, unsigned int *val)
+{
+ struct thread_data *td = data;
+
+ td->o.rwmix[DDIR_READ] = *val;
+ td->o.rwmix[DDIR_WRITE] = 100 - *val;
+ return 0;
+}
+
+static int str_rwmix_write_cb(void *data, unsigned int *val)
+{
+ struct thread_data *td = data;
+
+ td->o.rwmix[DDIR_WRITE] = *val;
+ td->o.rwmix[DDIR_READ] = 100 - *val;
+ return 0;
+}
+
#ifdef FIO_HAVE_IOPRIO
static int str_prioclass_cb(void *data, unsigned int *val)
{
return 0;
}
+static int check_dir(struct thread_data *td, char *fname)
+{
+ char file[PATH_MAX], *dir;
+ int elen = 0;
+
+ if (td->o.directory) {
+ strcpy(file, td->o.directory);
+ strcat(file, "/");
+ elen = strlen(file);
+ }
+
+ sprintf(file + elen, "%s", fname);
+ dir = dirname(file);
+
+#if 0
+ {
+ struct stat sb;
+ /*
+ * We can't do this on FIO_DISKLESSIO engines. The engine isn't loaded
+ * yet, so we can't do this check right here...
+ */
+ if (lstat(dir, &sb) < 0) {
+ int ret = errno;
+
+ log_err("fio: %s is not a directory\n", dir);
+ td_verror(td, ret, "lstat");
+ return 1;
+ }
+
+ if (!S_ISDIR(sb.st_mode)) {
+ log_err("fio: %s is not a directory\n", dir);
+ return 1;
+ }
+ }
+#endif
+
+ return 0;
+}
+
static int str_filename_cb(void *data, const char *input)
{
struct thread_data *td = data;
while ((fname = strsep(&str, ":")) != NULL) {
if (!strlen(fname))
break;
+ if (check_dir(td, fname)) {
+ free(p);
+ return 1;
+ }
add_file(td, fname);
td->o.nr_files++;
}
struct stat sb;
if (lstat(td->o.directory, &sb) < 0) {
+ int ret = errno;
+
log_err("fio: %s is not a directory\n", td->o.directory);
- td_verror(td, errno, "lstat");
+ td_verror(td, ret, "lstat");
return 1;
}
if (!S_ISDIR(sb.st_mode)) {
struct thread_data *td = data;
unsigned int msb;
- msb = fls(*off);
+ msb = __fls(*off);
if (msb <= 8)
td->o.verify_pattern_bytes = 1;
else if (msb <= 16)
{ .ival = "posixaio",
.help = "POSIX asynchronous IO",
},
+#endif
+#ifdef FIO_HAVE_SOLARISAIO
+ { .ival = "solarisaio",
+ .help = "Solaris native asynchronous IO",
+ },
#endif
{ .ival = "mmap",
.help = "Memory mapped IO",
},
{
.name = "iodepth_batch",
+ .alias = "iodepth_batch_submit",
.type = FIO_OPT_INT,
.off1 = td_var_offset(iodepth_batch),
.help = "Number of IO to submit in one go",
.minval = 1,
.def = "1",
},
+ {
+ .name = "iodepth_batch_complete",
+ .type = FIO_OPT_INT,
+ .off1 = td_var_offset(iodepth_batch_complete),
+ .help = "Number of IO to retrieve in one go",
+ .parent = "iodepth",
+ .minval = 0,
+ .def = "1",
+ },
{
.name = "iodepth_low",
.type = FIO_OPT_INT,
.help = "Accept potential duplicate random blocks",
.parent = "rw",
},
+ {
+ .name = "softrandommap",
+ .type = FIO_OPT_BOOL,
+ .off1 = td_var_offset(softrandommap),
+ .help = "Set norandommap if randommap allocation fails",
+ .parent = "norandommap",
+ .def = "0",
+ },
{
.name = "nrfiles",
.type = FIO_OPT_INT,
{
.name = "rwmixread",
.type = FIO_OPT_INT,
- .off1 = td_var_offset(rwmix[DDIR_READ]),
+ .cb = str_rwmix_read_cb,
.maxval = 100,
.help = "Percentage of mixed workload that is reads",
.def = "50",
{
.name = "rwmixwrite",
.type = FIO_OPT_INT,
- .off1 = td_var_offset(rwmix[DDIR_WRITE]),
+ .cb = str_rwmix_write_cb,
.maxval = 100,
.help = "Percentage of mixed workload that is writes",
.def = "50",
},
{
.name = "rwmixcycle",
- .type = FIO_OPT_INT,
- .off1 = td_var_offset(rwmixcycle),
- .help = "Cycle period for mixed read/write workloads (msec)",
- .def = "500",
- .parent = "rwmixread",
+ .type = FIO_OPT_DEPRECATED,
},
{
.name = "nice",
.off1 = td_var_offset(zero_buffers),
.help = "Init IO buffers to all zeroes",
},
+ {
+ .name = "refill_buffers",
+ .type = FIO_OPT_STR_SET,
+ .off1 = td_var_offset(refill_buffers),
+ .help = "Refill IO buffers on every IO submit",
+ },
#ifdef FIO_HAVE_DISK_UTIL
{
.name = "disk_util",
.type = FIO_OPT_BOOL,
.off1 = td_var_offset(do_disk_util),
- .help = "Log disk utilization stats",
+ .help = "Log disk utilization statistics",
.def = "1",
},
#endif
o = &options[0];
while (o->name) {
- long_options[i].name = o->name;
+ long_options[i].name = (char *) o->name;
long_options[i].val = FIO_GETOPT_JOB;
if (o->type == FIO_OPT_STR_SET)
long_options[i].has_arg = no_argument;