#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <netinet/in.h>
#include "fio.h"
#include "verify.h"
#include "crc/crc32c.h"
+char client_sockaddr_str[INET6_ADDRSTRLEN] = { 0 };
+
/*
* Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
*/
* Returns the directory at the index, indexes > entires will be
* assigned via modulo division of the index
*/
-int set_name_idx(char *target, char *input, int index)
+int set_name_idx(char *target, size_t tlen, char *input, int index)
{
unsigned int cur_idx;
int len;
for (cur_idx = 0; cur_idx <= index; cur_idx++)
fname = get_next_name(&str);
- len = sprintf(target, "%s/", fname);
+ if (client_sockaddr_str[0]) {
+ len = snprintf(target, tlen, "%s/%s.", fname,
+ client_sockaddr_str);
+ } else
+ len = snprintf(target, tlen, "%s/", fname);
+
+ target[tlen - 1] = '\0';
free(p);
return len;
static int pattern_cb(char *pattern, unsigned int max_size,
const char *input, unsigned int *pattern_bytes)
{
- long off;
+ long off = 0;
int i = 0, j = 0, len, k, base = 10;
uint32_t pattern_length;
char *loc1, *loc2;
*/
fill:
pattern_length = i;
+ if (!i && !off)
+ i = 1;
while (i > 1 && i * 2 <= max_size) {
memcpy(&pattern[i], &pattern[0], i);
i *= 2;
/*
* VERIFY_META could already be set
*/
- if (!ret && td->o.verify == VERIFY_NONE)
+ if (!ret && !fio_option_is_set(&td->o, verify))
td->o.verify = VERIFY_PATTERN;
return ret;
.type = FIO_OPT_STR_VAL,
.off1 = td_var_offset(rand_seed),
.help = "Set the random generator seed value",
+ .def = "0x89",
.parent = "rw",
.category = FIO_OPT_C_IO,
.group = FIO_OPT_G_RANDOM,
.oval = FIO_RAND_GEN_LFSR,
.help = "Variable length LFSR",
},
+ {
+ .ival = "tausworthe64",
+ .oval = FIO_RAND_GEN_TAUSWORTHE64,
+ .help = "64-bit Tausworthe variant",
+ },
},
.category = FIO_OPT_C_IO,
.group = FIO_OPT_G_RANDOM,
.oval = VERIFY_META,
.help = "Use io information",
},
+ { .ival = "pattern",
+ .oval = VERIFY_PATTERN_NO_HDR,
+ .help = "Verify strict pattern",
+ },
{
.ival = "null",
.oval = VERIFY_NULL,
.category = FIO_OPT_C_IO,
.group = FIO_OPT_G_IOLOG,
},
+ {
+ .name = "replay_scale",
+ .lname = "Replace offset scale factor",
+ .type = FIO_OPT_INT,
+ .off1 = td_var_offset(replay_scale),
+ .parent = "read_iolog",
+ .def = "1",
+ .help = "Align offsets to this blocksize",
+ .category = FIO_OPT_C_IO,
+ .group = FIO_OPT_G_IOLOG,
+ },
+ {
+ .name = "replay_align",
+ .lname = "Replace alignment",
+ .type = FIO_OPT_INT,
+ .off1 = td_var_offset(replay_align),
+ .parent = "read_iolog",
+ .help = "Scale offset down by this factor",
+ .category = FIO_OPT_C_IO,
+ .group = FIO_OPT_G_IOLOG,
+ .pow2 = 1,
+ },
{
.name = "exec_prerun",
.lname = "Pre-execute runnable",
.category = FIO_OPT_C_FILE,
.def = "0",
},
+ {
+ .name = "allow_file_create",
+ .lname = "Allow file create",
+ .type = FIO_OPT_BOOL,
+ .off1 = td_var_offset(allow_create),
+ .help = "Permit fio to create files, if they don't exist",
+ .def = "1",
+ .category = FIO_OPT_C_FILE,
+ .group = FIO_OPT_G_FILENAME,
+ },
+ {
+ .name = "allow_mounted_write",
+ .lname = "Allow mounted write",
+ .type = FIO_OPT_BOOL,
+ .off1 = td_var_offset(allow_mounted_write),
+ .help = "Allow writes to a mounted partition",
+ .def = "0",
+ .category = FIO_OPT_C_FILE,
+ .group = FIO_OPT_G_FILENAME,
+ },
{
.name = "pre_read",
.lname = "Pre-read files",
.category = FIO_OPT_C_GENERAL,
.group = FIO_OPT_G_PROCESS,
},
+ {
+ .name = "per_job_logs",
+ .type = FIO_OPT_BOOL,
+ .off1 = td_var_offset(per_job_logs),
+ .help = "Include job number in generated log files or not",
+ .def = "1",
+ .category = FIO_OPT_C_LOG,
+ .group = FIO_OPT_G_INVALID,
+ },
{
.name = "write_bw_log",
.lname = "Write bandwidth log",
},
};
+void fio_keywords_exit(void)
+{
+ struct fio_keyword *kw;
+
+ kw = &fio_keywords[0];
+ while (kw->word) {
+ free(kw->replace);
+ kw->replace = NULL;
+ kw++;
+ }
+}
+
void fio_keywords_init(void)
{
unsigned long long mb_memory;
opt_off = opt - &fio_options[0];
index = opt_off / (8 * sizeof(uint64_t));
offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
- return (o->set_options[index] & (1UL << offset)) != 0;
+ return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
}
int __fio_option_is_set(struct thread_options *o, unsigned int off1)
opt_off = opt - &fio_options[0];
index = opt_off / (8 * sizeof(uint64_t));
offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
- o->set_options[index] |= 1UL << offset;
+ o->set_options[index] |= (uint64_t)1 << offset;
}