summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
2bb3f0a)
We either need to eliminate the option callbacks, or ensure that
they don't have side effects outside of touching td->o. We will
need to use &td->o as the data passed in for the callbacks, not
the full td.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fio_gettime(&td->epoch, NULL);
getrusage(RUSAGE_SELF, &td->ru_start);
fio_gettime(&td->epoch, NULL);
getrusage(RUSAGE_SELF, &td->ru_start);
string_to_cpu(&o->filename, top->filename);
string_to_cpu(&o->opendir, top->opendir);
string_to_cpu(&o->ioengine, top->ioengine);
string_to_cpu(&o->filename, top->filename);
string_to_cpu(&o->opendir, top->opendir);
string_to_cpu(&o->ioengine, top->ioengine);
+ string_to_cpu(&o->mmapfile, top->mmapfile);
string_to_cpu(&o->read_iolog_file, top->read_iolog_file);
string_to_cpu(&o->write_iolog_file, top->write_iolog_file);
string_to_cpu(&o->bw_log_file, top->bw_log_file);
string_to_cpu(&o->read_iolog_file, top->read_iolog_file);
string_to_cpu(&o->write_iolog_file, top->write_iolog_file);
string_to_cpu(&o->bw_log_file, top->bw_log_file);
string_to_net(top->filename, o->filename);
string_to_net(top->opendir, o->opendir);
string_to_net(top->ioengine, o->ioengine);
string_to_net(top->filename, o->filename);
string_to_net(top->opendir, o->opendir);
string_to_net(top->ioengine, o->ioengine);
+ string_to_net(top->mmapfile, o->mmapfile);
string_to_net(top->read_iolog_file, o->read_iolog_file);
string_to_net(top->write_iolog_file, o->write_iolog_file);
string_to_net(top->bw_log_file, o->bw_log_file);
string_to_net(top->read_iolog_file, o->read_iolog_file);
string_to_net(top->write_iolog_file, o->write_iolog_file);
string_to_net(top->bw_log_file, o->bw_log_file);
unsigned int last_was_sync;
enum fio_ddir last_ddir;
unsigned int last_was_sync;
enum fio_ddir last_ddir;
int mmapfd;
void *iolog_buf;
int mmapfd;
void *iolog_buf;
else if (o->def) {
long long val;
else if (o->def) {
long long val;
- check_str_bytes(o->def, &val, NULL);
+ check_str_bytes(o->def, &val, o);
if (o->def) {
long long val;
if (o->def) {
long long val;
- check_str_bytes(o->def, &val, NULL);
+ check_str_bytes(o->def, &val, o);
for (i = 0; i < GOPT_RANGE_SPIN; i++)
defvals[i] = val;
}
for (i = 0; i < GOPT_RANGE_SPIN; i++)
defvals[i] = val;
}
- if (td->mmapfile) {
- td->mmapfd = open(td->mmapfile, O_RDWR|O_CREAT, 0644);
+ if (td->o.mmapfile) {
+ td->mmapfd = open(td->o.mmapfile, O_RDWR|O_CREAT, 0644);
if (td->mmapfd < 0) {
td_verror(td, errno, "open mmap file");
if (td->mmapfd < 0) {
td_verror(td, errno, "open mmap file");
td->orig_buffer = NULL;
if (td->mmapfd) {
close(td->mmapfd);
td->orig_buffer = NULL;
if (td->mmapfd) {
close(td->mmapfd);
+ unlink(td->o.mmapfile);
{
dprint(FD_MEM, "munmap %u %p\n", total_mem, td->orig_buffer);
munmap(td->orig_buffer, td->orig_buffer_size);
{
dprint(FD_MEM, "munmap %u %p\n", total_mem, td->orig_buffer);
munmap(td->orig_buffer, td->orig_buffer_size);
- unlink(td->mmapfile);
- free(td->mmapfile);
+ unlink(td->o.mmapfile);
+ free(td->o.mmapfile);
return bsp1->perc < bsp2->perc;
}
return bsp1->perc < bsp2->perc;
}
-static int bssplit_ddir(struct thread_data *td, int ddir, char *str)
+static int bssplit_ddir(struct thread_options *o, int ddir, char *str)
{
struct bssplit *bssplit;
unsigned int i, perc, perc_missing;
{
struct bssplit *bssplit;
unsigned int i, perc, perc_missing;
long long val;
char *fname;
long long val;
char *fname;
- td->o.bssplit_nr[ddir] = 4;
+ o->bssplit_nr[ddir] = 4;
bssplit = malloc(4 * sizeof(struct bssplit));
i = 0;
bssplit = malloc(4 * sizeof(struct bssplit));
i = 0;
/*
* grow struct buffer, if needed
*/
/*
* grow struct buffer, if needed
*/
- if (i == td->o.bssplit_nr[ddir]) {
- td->o.bssplit_nr[ddir] <<= 1;
- bssplit = realloc(bssplit, td->o.bssplit_nr[ddir]
+ if (i == o->bssplit_nr[ddir]) {
+ o->bssplit_nr[ddir] <<= 1;
+ bssplit = realloc(bssplit, o->bssplit_nr[ddir]
* sizeof(struct bssplit));
}
* sizeof(struct bssplit));
}
- if (str_to_decimal(fname, &val, 1, td)) {
+ if (str_to_decimal(fname, &val, 1, o)) {
log_err("fio: bssplit conversion failed\n");
log_err("fio: bssplit conversion failed\n");
- td->o.bssplit_nr[ddir] = i;
+ o->bssplit_nr[ddir] = i;
/*
* Now check if the percentages add up, and how much is missing
*/
perc = perc_missing = 0;
/*
* Now check if the percentages add up, and how much is missing
*/
perc = perc_missing = 0;
- for (i = 0; i < td->o.bssplit_nr[ddir]; i++) {
+ for (i = 0; i < o->bssplit_nr[ddir]; i++) {
struct bssplit *bsp = &bssplit[i];
if (bsp->perc == (unsigned char) -1)
struct bssplit *bsp = &bssplit[i];
if (bsp->perc == (unsigned char) -1)
* them.
*/
if (perc_missing) {
* them.
*/
if (perc_missing) {
- for (i = 0; i < td->o.bssplit_nr[ddir]; i++) {
+ for (i = 0; i < o->bssplit_nr[ddir]; i++) {
struct bssplit *bsp = &bssplit[i];
if (bsp->perc == (unsigned char) -1)
struct bssplit *bsp = &bssplit[i];
if (bsp->perc == (unsigned char) -1)
- td->o.min_bs[ddir] = min_bs;
- td->o.max_bs[ddir] = max_bs;
+ o->min_bs[ddir] = min_bs;
+ o->max_bs[ddir] = max_bs;
/*
* now sort based on percentages, for ease of lookup
*/
/*
* now sort based on percentages, for ease of lookup
*/
- qsort(bssplit, td->o.bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
- td->o.bssplit[ddir] = bssplit;
+ qsort(bssplit, o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
+ o->bssplit[ddir] = bssplit;
odir = strchr(str, ',');
if (odir) {
odir = strchr(str, ',');
if (odir) {
- ret = bssplit_ddir(td, DDIR_WRITE, odir + 1);
+ ret = bssplit_ddir(&td->o, DDIR_WRITE, odir + 1);
if (!ret) {
*odir = '\0';
if (!ret) {
*odir = '\0';
- ret = bssplit_ddir(td, DDIR_READ, str);
+ ret = bssplit_ddir(&td->o, DDIR_READ, str);
}
} else {
char *op;
op = strdup(str);
}
} else {
char *op;
op = strdup(str);
- ret = bssplit_ddir(td, DDIR_READ, str);
+ ret = bssplit_ddir(&td->o, DDIR_READ, str);
- ret = bssplit_ddir(td, DDIR_WRITE, op);
+ ret = bssplit_ddir(&td->o, DDIR_WRITE, op);
static int str_rw_cb(void *data, const char *str)
{
struct thread_data *td = data;
static int str_rw_cb(void *data, const char *str)
{
struct thread_data *td = data;
+ struct thread_options *o = &td->o;
char *nr = get_opt_postfix(str);
char *nr = get_opt_postfix(str);
- td->o.ddir_seq_nr = 1;
- td->o.ddir_seq_add = 0;
+ o->ddir_seq_nr = 1;
+ o->ddir_seq_add = 0;
if (!nr)
return 0;
if (td_random(td))
if (!nr)
return 0;
if (td_random(td))
- td->o.ddir_seq_nr = atoi(nr);
+ o->ddir_seq_nr = atoi(nr);
- if (str_to_decimal(nr, &val, 1, td)) {
+ if (str_to_decimal(nr, &val, 1, o)) {
log_err("fio: rw postfix parsing failed\n");
free(nr);
return 1;
}
log_err("fio: rw postfix parsing failed\n");
free(nr);
return 1;
}
- td->o.ddir_seq_add = val;
static int str_mem_cb(void *data, const char *mem)
{
struct thread_data *td = data;
static int str_mem_cb(void *data, const char *mem)
{
struct thread_data *td = data;
+ struct thread_options *o = &td->o;
- if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP) {
- td->mmapfile = get_opt_postfix(mem);
- if (td->o.mem_type == MEM_MMAPHUGE && !td->mmapfile) {
+ if (o->mem_type == MEM_MMAPHUGE || o->mem_type == MEM_MMAP) {
+ o->mmapfile = get_opt_postfix(mem);
+ if (o->mem_type == MEM_MMAPHUGE && !o->mmapfile) {
log_err("fio: mmaphuge:/path/to/file\n");
return 1;
}
log_err("fio: mmaphuge:/path/to/file\n");
return 1;
}
-static int str_verify_cb(void *data, const char *mem)
-{
- struct thread_data *td = data;
-
- if (td->o.verify == VERIFY_CRC32C_INTEL ||
- td->o.verify == VERIFY_CRC32C) {
- crc32c_intel_probe();
- }
-
- return 0;
-}
-
static int fio_clock_source_cb(void *data, const char *str)
{
struct thread_data *td = data;
static int fio_clock_source_cb(void *data, const char *str)
{
struct thread_data *td = data;
.type = FIO_OPT_STR,
.off1 = td_var_offset(verify),
.help = "Verify data written",
.type = FIO_OPT_STR,
.off1 = td_var_offset(verify),
.help = "Verify data written",
.def = "0",
.category = FIO_OPT_C_IO,
.group = FIO_OPT_G_VERIFY,
.def = "0",
.category = FIO_OPT_C_IO,
.group = FIO_OPT_G_VERIFY,
unsigned int fio_get_kb_base(void *data)
{
unsigned int fio_get_kb_base(void *data)
{
- struct thread_data *td = data;
+ struct thread_options *o = data;
unsigned int kb_base = 0;
unsigned int kb_base = 0;
- if (td)
- kb_base = td->o.kb_base;
+ if (o)
+ kb_base = o->kb_base;
if (!kb_base)
kb_base = 1024;
if (!kb_base)
kb_base = 1024;
char *filename;
char *opendir;
char *ioengine;
char *filename;
char *opendir;
char *ioengine;
enum td_ddir td_ddir;
unsigned int rw_seq;
unsigned int kb_base;
enum td_ddir td_ddir;
unsigned int rw_seq;
unsigned int kb_base;
uint8_t filename[FIO_TOP_STR_MAX];
uint8_t opendir[FIO_TOP_STR_MAX];
uint8_t ioengine[FIO_TOP_STR_MAX];
uint8_t filename[FIO_TOP_STR_MAX];
uint8_t opendir[FIO_TOP_STR_MAX];
uint8_t ioengine[FIO_TOP_STR_MAX];
+ uint8_t mmapfile[FIO_TOP_STR_MAX];
uint32_t td_ddir;
uint32_t rw_seq;
uint32_t kb_base;
uint32_t td_ddir;
uint32_t rw_seq;
uint32_t kb_base;
+void fio_verify_init(struct thread_data *td)
+{
+ if (td->o.verify == VERIFY_CRC32C_INTEL ||
+ td->o.verify == VERIFY_CRC32C) {
+ crc32c_intel_probe();
+ }
+}
+
static void *verify_async_thread(void *data)
{
struct thread_data *td = data;
static void *verify_async_thread(void *data)
{
struct thread_data *td = data;
extern int __must_check verify_io_u(struct thread_data *, struct io_u *);
extern int verify_io_u_async(struct thread_data *, struct io_u *);
extern void fill_pattern(struct thread_data *td, void *p, unsigned int len, struct io_u *io_u, unsigned long seed, int use_seed);
extern int __must_check verify_io_u(struct thread_data *, struct io_u *);
extern int verify_io_u_async(struct thread_data *, struct io_u *);
extern void fill_pattern(struct thread_data *td, void *p, unsigned int len, struct io_u *io_u, unsigned long seed, int use_seed);
+extern void fio_verify_init(struct thread_data *td);
/*
* Async verify offload
/*
* Async verify offload