#include <string.h>
#include <getopt.h>
#include <assert.h>
+#include <libgen.h>
#include "fio.h"
#include "parse.h"
*/
if (i == td->o.bssplit_nr) {
td->o.bssplit_nr <<= 1;
- td->o.bssplit = realloc(td->o.bssplit, td->o.bssplit_nr * sizeof(struct bssplit));
+ td->o.bssplit = realloc(td->o.bssplit,
+ td->o.bssplit_nr
+ * sizeof(struct bssplit));
}
perc_str = strstr(fname, "/");
free(p);
td->o.cpumask_set = 1;
- exit(0);
return 0;
}
#endif
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)) {
return 0;
}
+static int str_lockfile_cb(void *data, const char *str)
+{
+ struct thread_data *td = data;
+ char *nr = get_opt_postfix(str);
+
+ td->o.lockfile_batch = 1;
+ if (nr)
+ td->o.lockfile_batch = atoi(nr);
+
+ return 0;
+}
+
#define __stringify_1(x) #x
#define __stringify(x) __stringify_1(x)
.cb = str_filename_cb,
.help = "File(s) to use for the workload",
},
+ {
+ .name = "lockfile",
+ .type = FIO_OPT_STR,
+ .cb = str_lockfile_cb,
+ .off1 = td_var_offset(file_lock_mode),
+ .help = "Lock file when doing IO to it",
+ .parent = "filename",
+ .def = "none",
+ .posval = {
+ { .ival = "none",
+ .oval = FILE_LOCK_NONE,
+ .help = "No file locking",
+ },
+ { .ival = "exclusive",
+ .oval = FILE_LOCK_EXCLUSIVE,
+ .help = "Exclusive file lock",
+ },
+ {
+ .ival = "readwrite",
+ .oval = FILE_LOCK_READWRITE,
+ .help = "Read vs write lock",
+ },
+ },
+ },
{
.name = "opendir",
.type = FIO_OPT_STR_STORE,
.help = "Accept potential duplicate random blocks",
.parent = "rw",
},
+ {
+ .name = "softrandommap",
+ .type = FIO_OPT_BOOL,
+ .off1 = td_var_offset(softrandommap),
+ .help = "Allow randommap to fail and continue witout",
+ .parent = "norandommap",
+ .def = "0",
+ },
{
.name = "nrfiles",
.type = FIO_OPT_INT,
.type = FIO_OPT_STR_VAL_INT,
.help = "Offset verify header location by N bytes",
.def = "0",
- .cb = str_verify_offset_cb,
+ .cb = str_verify_offset_cb,
.parent = "verify",
},
{
},
{
.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",
.name = "bwavgtime",
.type = FIO_OPT_INT,
.off1 = td_var_offset(bw_avg_time),
- .help = "Time window over which to calculate bandwidth (msec)",
+ .help = "Time window over which to calculate bandwidth"
+ " (msec)",
.def = "500",
},
{
},
{
.name = "hugepage-size",
- .type = FIO_OPT_STR_VAL,
+ .type = FIO_OPT_STR_VAL_INT,
.off1 = td_var_offset(hugepage_size),
.help = "When using hugepages, specify size of each page",
.def = __stringify(FIO_HUGE_PAGE),
.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",