projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gclient: Delete unused code
[fio.git]
/
init.c
diff --git
a/init.c
b/init.c
index 048bd5d4fdec3183a37957f49a6d4f185b276977..f26f35dc5adcdca1b46133d934654651e8a8f021 100644
(file)
--- a/
init.c
+++ b/
init.c
@@
-25,6
+25,7
@@
#include "server.h"
#include "idletime.h"
#include "filelock.h"
#include "server.h"
#include "idletime.h"
#include "filelock.h"
+#include "steadystate.h"
#include "oslib/getopt.h"
#include "oslib/strcasestr.h"
#include "oslib/getopt.h"
#include "oslib/strcasestr.h"
@@
-47,7
+48,6
@@
static char **job_sections;
static int nr_job_sections;
int exitall_on_terminate = 0;
static int nr_job_sections;
int exitall_on_terminate = 0;
-int exitall_on_terminate_error = 0;
int output_format = FIO_OUTPUT_NORMAL;
int eta_print = FIO_ETA_AUTO;
int eta_new_line = 0;
int output_format = FIO_OUTPUT_NORMAL;
int eta_print = FIO_ETA_AUTO;
int eta_new_line = 0;
@@
-104,7
+104,7
@@
static struct option l_opts[FIO_NR_OPTIONS] = {
},
{
.name = (char *) "bandwidth-log",
},
{
.name = (char *) "bandwidth-log",
- .has_arg =
required
_argument,
+ .has_arg =
no
_argument,
.val = 'b' | FIO_CLIENT_FLAG,
},
{
.val = 'b' | FIO_CLIENT_FLAG,
},
{
@@
-114,7
+114,7
@@
static struct option l_opts[FIO_NR_OPTIONS] = {
},
{
.name = (char *) "output-format",
},
{
.name = (char *) "output-format",
- .has_arg =
optional
_argument,
+ .has_arg =
required
_argument,
.val = 'F' | FIO_CLIENT_FLAG,
},
{
.val = 'F' | FIO_CLIENT_FLAG,
},
{
@@
-299,7
+299,6
@@
void free_threads_shm(void)
static void free_shm(void)
{
if (threads) {
static void free_shm(void)
{
if (threads) {
- file_hash_exit();
flow_exit();
fio_debug_jobp = NULL;
free_threads_shm();
flow_exit();
fio_debug_jobp = NULL;
free_threads_shm();
@@
-310,8
+309,9
@@
static void free_shm(void)
free(trigger_remote_cmd);
trigger_file = trigger_cmd = trigger_remote_cmd = NULL;
free(trigger_remote_cmd);
trigger_file = trigger_cmd = trigger_remote_cmd = NULL;
- options_free(fio_options, &def_thread);
+ options_free(fio_options, &def_thread
.o
);
fio_filelock_exit();
fio_filelock_exit();
+ file_hash_exit();
scleanup();
}
scleanup();
}
@@
-323,8
+323,6
@@
static void free_shm(void)
*/
static int setup_thread_area(void)
{
*/
static int setup_thread_area(void)
{
- void *hash;
-
if (threads)
return 0;
if (threads)
return 0;
@@
-335,7
+333,6
@@
static int setup_thread_area(void)
do {
size_t size = max_jobs * sizeof(struct thread_data);
do {
size_t size = max_jobs * sizeof(struct thread_data);
- size += file_hash_size;
size += sizeof(unsigned int);
#ifndef CONFIG_NO_SHM
size += sizeof(unsigned int);
#ifndef CONFIG_NO_SHM
@@
-367,10
+364,8
@@
static int setup_thread_area(void)
#endif
memset(threads, 0, max_jobs * sizeof(struct thread_data));
#endif
memset(threads, 0, max_jobs * sizeof(struct thread_data));
- hash = (void *) threads + max_jobs * sizeof(struct thread_data);
- fio_debug_jobp = (void *) hash + file_hash_size;
+ fio_debug_jobp = (void *) threads + max_jobs * sizeof(struct thread_data);
*fio_debug_jobp = -1;
*fio_debug_jobp = -1;
- file_hash_init(hash);
flow_init();
flow_init();
@@
-677,7
+672,7
@@
static int fixup_options(struct thread_data *td)
"verify limited\n");
ret = warnings_fatal;
}
"verify limited\n");
ret = warnings_fatal;
}
- if (o->bs_unaligned && (o->odirect || td
->io_ops->flags & FIO_RAWIO
))
+ if (o->bs_unaligned && (o->odirect || td
_ioengine_flagged(td, FIO_RAWIO)
))
log_err("fio: bs_unaligned may not work with raw io\n");
/*
log_err("fio: bs_unaligned may not work with raw io\n");
/*
@@
-764,7
+759,7
@@
static int fixup_options(struct thread_data *td)
if (o->pre_read) {
o->invalidate_cache = 0;
if (o->pre_read) {
o->invalidate_cache = 0;
- if (td
->io_ops->flags & FIO_PIPEIO
) {
+ if (td
_ioengine_flagged(td, FIO_PIPEIO)
) {
log_info("fio: cannot pre-read files with an IO engine"
" that isn't seekable. Pre-read disabled.\n");
ret = warnings_fatal;
log_info("fio: cannot pre-read files with an IO engine"
" that isn't seekable. Pre-read disabled.\n");
ret = warnings_fatal;
@@
-772,7
+767,7
@@
static int fixup_options(struct thread_data *td)
}
if (!o->unit_base) {
}
if (!o->unit_base) {
- if (td
->io_ops->flags & FIO_BIT_BASED
)
+ if (td
_ioengine_flagged(td, FIO_BIT_BASED)
)
o->unit_base = 1;
else
o->unit_base = 8;
o->unit_base = 1;
else
o->unit_base = 8;
@@
-795,7
+790,7
@@
static int fixup_options(struct thread_data *td)
* Windows doesn't support O_DIRECT or O_SYNC with the _open interface,
* so fail if we're passed those flags
*/
* Windows doesn't support O_DIRECT or O_SYNC with the _open interface,
* so fail if we're passed those flags
*/
- if (
(td->io_ops->flags &
FIO_SYNCIO) && (td->o.odirect || td->o.sync_io)) {
+ if (
td_ioengine_flagged(td,
FIO_SYNCIO) && (td->o.odirect || td->o.sync_io)) {
log_err("fio: Windows does not support direct or non-buffered io with"
" the synchronous ioengines. Use the 'windowsaio' ioengine"
" with 'direct=1' and 'iodepth=1' instead.\n");
log_err("fio: Windows does not support direct or non-buffered io with"
" the synchronous ioengines. Use the 'windowsaio' ioengine"
" with 'direct=1' and 'iodepth=1' instead.\n");
@@
-828,7
+823,8
@@
static int fixup_options(struct thread_data *td)
* If size is set but less than the min block size, complain
*/
if (o->size && o->size < td_min_bs(td)) {
* If size is set but less than the min block size, complain
*/
if (o->size && o->size < td_min_bs(td)) {
- log_err("fio: size too small, must be larger than the IO size: %llu\n", (unsigned long long) o->size);
+ log_err("fio: size too small, must not be less than minimum block size: %llu < %u\n",
+ (unsigned long long) o->size, td_min_bs(td));
ret = 1;
}
ret = 1;
}
@@
-844,7
+840,7
@@
static int fixup_options(struct thread_data *td)
if (fio_option_is_set(&td->o, rand_seed))
td->o.rand_repeatable = 0;
if (fio_option_is_set(&td->o, rand_seed))
td->o.rand_repeatable = 0;
- if (
(td->io_ops->flags &
FIO_NOEXTEND) && td->o.file_append) {
+ if (
td_ioengine_flagged(td,
FIO_NOEXTEND) && td->o.file_append) {
log_err("fio: can't append/extent with IO engine %s\n", td->io_ops->name);
ret = 1;
}
log_err("fio: can't append/extent with IO engine %s\n", td->io_ops->name);
ret = 1;
}
@@
-904,26
+900,6
@@
static const char *get_engine_name(const char *str)
return p;
}
return p;
}
-static int exists_and_not_regfile(const char *filename)
-{
- struct stat sb;
-
- if (lstat(filename, &sb) == -1)
- return 0;
-
-#ifndef WIN32 /* NOT Windows */
- if (S_ISREG(sb.st_mode))
- return 0;
-#else
- /* \\.\ is the device namespace in Windows, where every file
- * is a device node */
- if (S_ISREG(sb.st_mode) && strncmp(filename, "\\\\.\\", 4) != 0)
- return 0;
-#endif
-
- return 1;
-}
-
static void init_rand_file_service(struct thread_data *td)
{
unsigned long nranges = td->o.nr_files << FIO_FSERVICE_SHIFT;
static void init_rand_file_service(struct thread_data *td)
{
unsigned long nranges = td->o.nr_files << FIO_FSERVICE_SHIFT;
@@
-1069,6
+1045,10
@@
int ioengine_load(struct thread_data *td)
*(struct thread_data **)td->eo = td;
}
*(struct thread_data **)td->eo = td;
}
+ if (td->o.odirect)
+ td->io_ops->flags |= FIO_RAWIO;
+
+ td_set_ioengine_flags(td);
return 0;
}
return 0;
}
@@
-1244,7
+1224,7
@@
static char *make_filename(char *buf, size_t buf_size,struct thread_options *o,
return buf;
}
return buf;
}
-
int
parse_dryrun(void)
+
bool
parse_dryrun(void)
{
return dump_cmdline || parse_only;
}
{
return dump_cmdline || parse_only;
}
@@
-1340,9
+1320,6
@@
static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
if (ioengine_load(td))
goto err;
if (ioengine_load(td))
goto err;
- if (o->odirect)
- td->io_ops->flags |= FIO_RAWIO;
-
file_alloced = 0;
if (!o->filename && !td->files_index && !o->read_iolog_file) {
file_alloced = 1;
file_alloced = 0;
if (!o->filename && !td->files_index && !o->read_iolog_file) {
file_alloced = 1;
@@
-1373,7
+1350,7
@@
static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
if (td->eo)
*(struct thread_data **)td->eo = NULL;
if (td->eo)
*(struct thread_data **)td->eo = NULL;
- if (td
->io_ops->flags & FIO_DISKLESSIO
) {
+ if (td
_ioengine_flagged(td, FIO_DISKLESSIO)
) {
struct fio_file *f;
for_each_file(td, f, i)
struct fio_file *f;
for_each_file(td, f, i)
@@
-1414,7
+1391,7
@@
static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
if (setup_rate(td))
goto err;
if (setup_rate(td))
goto err;
- if (o->
lat_log_file
) {
+ if (o->
write_lat_log
) {
struct log_params p = {
.td = td,
.avg_msec = o->log_avg_msec,
struct log_params p = {
.td = td,
.avg_msec = o->log_avg_msec,
@@
-1425,6
+1402,7
@@
static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
.log_gz = o->log_gz,
.log_gz_store = o->log_gz_store,
};
.log_gz = o->log_gz,
.log_gz_store = o->log_gz_store,
};
+ const char *pre = o->lat_log_file ? o->lat_log_file : o->name;
const char *suf;
if (p.log_gz_store)
const char *suf;
if (p.log_gz_store)
@@
-1432,20
+1410,20
@@
static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
else
suf = "log";
else
suf = "log";
- gen_log_name(logname, sizeof(logname), "lat",
o->lat_log_fil
e,
+ gen_log_name(logname, sizeof(logname), "lat",
pr
e,
td->thread_number, suf, o->per_job_logs);
setup_log(&td->lat_log, &p, logname);
td->thread_number, suf, o->per_job_logs);
setup_log(&td->lat_log, &p, logname);
- gen_log_name(logname, sizeof(logname), "slat",
o->lat_log_fil
e,
+ gen_log_name(logname, sizeof(logname), "slat",
pr
e,
td->thread_number, suf, o->per_job_logs);
setup_log(&td->slat_log, &p, logname);
td->thread_number, suf, o->per_job_logs);
setup_log(&td->slat_log, &p, logname);
- gen_log_name(logname, sizeof(logname), "clat",
o->lat_log_fil
e,
+ gen_log_name(logname, sizeof(logname), "clat",
pr
e,
td->thread_number, suf, o->per_job_logs);
setup_log(&td->clat_log, &p, logname);
}
td->thread_number, suf, o->per_job_logs);
setup_log(&td->clat_log, &p, logname);
}
- if (o->
hist_log_file
) {
+ if (o->
write_hist_log
) {
struct log_params p = {
.td = td,
.avg_msec = o->log_avg_msec,
struct log_params p = {
.td = td,
.avg_msec = o->log_avg_msec,
@@
-1456,19
+1434,27
@@
static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
.log_gz = o->log_gz,
.log_gz_store = o->log_gz_store,
};
.log_gz = o->log_gz,
.log_gz_store = o->log_gz_store,
};
+ const char *pre = o->hist_log_file ? o->hist_log_file : o->name;
const char *suf;
const char *suf;
+#ifndef CONFIG_ZLIB
+ if (td->client_type) {
+ log_err("fio: --write_hist_log requires zlib in client/server mode\n");
+ goto err;
+ }
+#endif
+
if (p.log_gz_store)
suf = "log.fz";
else
suf = "log";
if (p.log_gz_store)
suf = "log.fz";
else
suf = "log";
- gen_log_name(logname, sizeof(logname), "clat_hist",
o->hist_log_fil
e,
+ gen_log_name(logname, sizeof(logname), "clat_hist",
pr
e,
td->thread_number, suf, o->per_job_logs);
setup_log(&td->clat_hist_log, &p, logname);
}
td->thread_number, suf, o->per_job_logs);
setup_log(&td->clat_hist_log, &p, logname);
}
- if (o->
bw_log_file
) {
+ if (o->
write_bw_log
) {
struct log_params p = {
.td = td,
.avg_msec = o->log_avg_msec,
struct log_params p = {
.td = td,
.avg_msec = o->log_avg_msec,
@@
-1479,6
+1465,7
@@
static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
.log_gz = o->log_gz,
.log_gz_store = o->log_gz_store,
};
.log_gz = o->log_gz,
.log_gz_store = o->log_gz_store,
};
+ const char *pre = o->bw_log_file ? o->bw_log_file : o->name;
const char *suf;
if (fio_option_is_set(o, bw_avg_time))
const char *suf;
if (fio_option_is_set(o, bw_avg_time))
@@
-1494,11
+1481,11
@@
static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
else
suf = "log";
else
suf = "log";
- gen_log_name(logname, sizeof(logname), "bw",
o->bw_log_fil
e,
+ gen_log_name(logname, sizeof(logname), "bw",
pr
e,
td->thread_number, suf, o->per_job_logs);
setup_log(&td->bw_log, &p, logname);
}
td->thread_number, suf, o->per_job_logs);
setup_log(&td->bw_log, &p, logname);
}
- if (o->
iops_log_file
) {
+ if (o->
write_iops_log
) {
struct log_params p = {
.td = td,
.avg_msec = o->log_avg_msec,
struct log_params p = {
.td = td,
.avg_msec = o->log_avg_msec,
@@
-1509,6
+1496,7
@@
static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
.log_gz = o->log_gz,
.log_gz_store = o->log_gz_store,
};
.log_gz = o->log_gz,
.log_gz_store = o->log_gz_store,
};
+ const char *pre = o->iops_log_file ? o->iops_log_file : o->name;
const char *suf;
if (fio_option_is_set(o, iops_avg_time))
const char *suf;
if (fio_option_is_set(o, iops_avg_time))
@@
-1524,7
+1512,7
@@
static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
else
suf = "log";
else
suf = "log";
- gen_log_name(logname, sizeof(logname), "iops",
o->iops_log_fil
e,
+ gen_log_name(logname, sizeof(logname), "iops",
pr
e,
td->thread_number, suf, o->per_job_logs);
setup_log(&td->iops_log, &p, logname);
}
td->thread_number, suf, o->per_job_logs);
setup_log(&td->iops_log, &p, logname);
}
@@
-1537,7
+1525,7
@@
static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
if (is_backend && !recursed)
fio_server_send_add_job(td);
if (is_backend && !recursed)
fio_server_send_add_job(td);
- if (!
(td->io_ops->flags &
FIO_NOIO)) {
+ if (!
td_ioengine_flagged(td,
FIO_NOIO)) {
char *c1, *c2, *c3, *c4;
char *c5 = NULL, *c6 = NULL;
char *c1, *c2, *c3, *c4;
char *c5 = NULL, *c6 = NULL;
@@
-1576,6
+1564,9
@@
static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
log_info("...\n");
}
log_info("...\n");
}
+ if (td_steadystate_init(td))
+ goto err;
+
/*
* recurse add identical jobs, clear numjobs and stonewall options
* as they don't apply to sub-jobs
/*
* recurse add identical jobs, clear numjobs and stonewall options
* as they don't apply to sub-jobs
@@
-1591,6
+1582,8
@@
static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
td_new->o.stonewall = 0;
td_new->o.new_group = 0;
td_new->subjob_number = numjobs;
td_new->o.stonewall = 0;
td_new->o.new_group = 0;
td_new->subjob_number = numjobs;
+ td_new->o.ss_dur = o->ss_dur * 1000000l;
+ td_new->o.ss_limit = o->ss_limit;
if (file_alloced) {
if (td_new->files) {
if (file_alloced) {
if (td_new->files) {
@@
-1693,7
+1686,7
@@
static int is_empty_or_comment(char *line)
/*
* This is our [ini] type file parser.
*/
/*
* This is our [ini] type file parser.
*/
-int __parse_jobs_ini(struct thread_data *td,
+
static
int __parse_jobs_ini(struct thread_data *td,
char *file, int is_buf, int stonewall_flag, int type,
int nested, char *name, char ***popts, int *aopts, int *nopts)
{
char *file, int is_buf, int stonewall_flag, int type,
int nested, char *name, char ***popts, int *aopts, int *nopts)
{
@@
-2019,7
+2012,7
@@
static void usage(const char *name)
printf(" --parse-only\t\tParse options only, don't start any IO\n");
printf(" --output\t\tWrite output to file\n");
printf(" --runtime\t\tRuntime in seconds\n");
printf(" --parse-only\t\tParse options only, don't start any IO\n");
printf(" --output\t\tWrite output to file\n");
printf(" --runtime\t\tRuntime in seconds\n");
- printf(" --bandwidth-log\tGenerate
per-job
bandwidth logs\n");
+ printf(" --bandwidth-log\tGenerate
aggregate
bandwidth logs\n");
printf(" --minimal\t\tMinimal (terse) output\n");
printf(" --output-format=x\tOutput format (terse,json,json+,normal)\n");
printf(" --terse-version=x\tSet terse version output format to 'x'\n");
printf(" --minimal\t\tMinimal (terse) output\n");
printf(" --output-format=x\tOutput format (terse,json,json+,normal)\n");
printf(" --terse-version=x\tSet terse version output format to 'x'\n");
@@
-2133,6
+2126,14
@@
struct debug_level debug_levels[] = {
.help = "Log compression logging",
.shift = FD_COMPRESS,
},
.help = "Log compression logging",
.shift = FD_COMPRESS,
},
+ { .name = "steadystate",
+ .help = "Steady state detection logging",
+ .shift = FD_STEADYSTATE,
+ },
+ { .name = "helperthread",
+ .help = "Helper thread logging",
+ .shift = FD_HELPERTHREAD,
+ },
{ .name = NULL, },
};
{ .name = NULL, },
};
@@
-2302,7
+2303,7
@@
int parse_cmd_line(int argc, char *argv[], int client_type)
struct thread_data *td = NULL;
int c, ini_idx = 0, lidx, ret = 0, do_exit = 0, exit_val = 0;
char *ostr = cmd_optstr;
struct thread_data *td = NULL;
int c, ini_idx = 0, lidx, ret = 0, do_exit = 0, exit_val = 0;
char *ostr = cmd_optstr;
-
void
*pid_file = NULL;
+
char
*pid_file = NULL;
void *cur_client = NULL;
int backend = 0;
void *cur_client = NULL;
int backend = 0;
@@
-2321,6
+2322,8
@@
int parse_cmd_line(int argc, char *argv[], int client_type)
switch (c) {
case 'a':
smalloc_pool_size = atoi(optarg);
switch (c) {
case 'a':
smalloc_pool_size = atoi(optarg);
+ smalloc_pool_size <<= 10;
+ sinit();
break;
case 't':
if (check_str_time(optarg, &def_timeout, 1)) {
break;
case 't':
if (check_str_time(optarg, &def_timeout, 1)) {
@@
-2352,12
+2355,6
@@
int parse_cmd_line(int argc, char *argv[], int client_type)
output_format = FIO_OUTPUT_TERSE;
break;
case 'F':
output_format = FIO_OUTPUT_TERSE;
break;
case 'F':
- if (!optarg) {
- log_err("fio: missing --output-format argument\n");
- exit_val = 1;
- do_exit++;
- break;
- }
if (parse_output_format(optarg)) {
log_err("fio: failed parsing output-format\n");
exit_val = 1;
if (parse_output_format(optarg)) {
log_err("fio: failed parsing output-format\n");
exit_val = 1;