options: get rid of more .cb option usage we don't need
[fio.git] / init.c
diff --git a/init.c b/init.c
index 2d10498b2eaa31ab0f355c77e0c11fa1cc115f8b..742262867a3d51ecd529b033264789ee00c947d0 100644 (file)
--- a/init.c
+++ b/init.c
 
 #include "fio_version.h"
 
-#if FIO_PATCH > 0
-const char fio_version_string[] =      __fio_stringify(FIO_MAJOR) "."  \
-                                       __fio_stringify(FIO_MINOR) "."  \
-                                       __fio_stringify(FIO_PATCH);
-#else
-const char fio_version_string[] =      __fio_stringify(FIO_MAJOR) "."  \
-                                       __fio_stringify(FIO_MINOR);
-#endif
+const char fio_version_string[] = FIO_VERSION;
 
 #define FIO_RANDSEED           (0xb1899bedUL)
 
@@ -47,7 +40,6 @@ struct thread_data *threads = NULL;
 int exitall_on_terminate = 0;
 int terse_output = 0;
 int eta_print;
-unsigned long long mlock_size = 0;
 FILE *f_out = NULL;
 FILE *f_err = NULL;
 char **job_sections = NULL;
@@ -74,21 +66,23 @@ static char cmd_optstr[256];
 static int did_arg;
 
 const fio_fp64_t def_percentile_list[FIO_IO_U_LIST_MAX_LEN] = {
-       { .u.f  =  1.0 },
-       { .u.f  =  5.0 },
-       { .u.f  = 10.0 },
-       { .u.f  = 20.0 },
-       { .u.f  = 30.0 },
-       { .u.f  = 40.0 },
-       { .u.f  = 50.0 },
-       { .u.f  = 60.0 },
-       { .u.f  = 70.0 },
-       { .u.f  = 80.0 },
-       { .u.f  = 90.0 },
-       { .u.f  = 95.0 },
-       { .u.f  = 99.0 },
-       { .u.f  = 99.5 },
-       { .u.f  = 99.9 },
+       { .u.f  =  1.00 },
+       { .u.f  =  5.00 },
+       { .u.f  = 10.00 },
+       { .u.f  = 20.00 },
+       { .u.f  = 30.00 },
+       { .u.f  = 40.00 },
+       { .u.f  = 50.00 },
+       { .u.f  = 60.00 },
+       { .u.f  = 70.00 },
+       { .u.f  = 80.00 },
+       { .u.f  = 90.00 },
+       { .u.f  = 95.00 },
+       { .u.f  = 99.00 },
+       { .u.f  = 99.50 },
+       { .u.f  = 99.90 },
+       { .u.f  = 99.95 },
+       { .u.f  = 99.99 },
 };
 
 #define FIO_CLIENT_FLAG                (1 << 16)
@@ -212,7 +206,7 @@ static struct option l_opts[FIO_NR_OPTIONS] = {
        },
 };
 
-static void free_shm(void)
+void free_threads_shm(void)
 {
        struct shmid_ds sbuf;
 
@@ -220,11 +214,19 @@ static void free_shm(void)
                void *tp = threads;
 
                threads = NULL;
+               shmdt(tp);
+               shmctl(shm_id, IPC_RMID, &sbuf);
+               shm_id = -1;
+       }
+}
+
+void free_shm(void)
+{
+       if (threads) {
                file_hash_exit();
                flow_exit();
                fio_debug_jobp = NULL;
-               shmdt(tp);
-               shmctl(shm_id, IPC_RMID, &sbuf);
+               free_threads_shm();
        }
 
        scleanup();
@@ -773,11 +775,6 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
        if (ioengine_load(td))
                goto err;
 
-       if (td->o.use_thread)
-               nr_thread++;
-       else
-               nr_process++;
-
        if (td->o.odirect)
                td->io_ops->flags |= FIO_RAWIO;
 
@@ -845,14 +842,14 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
        if (setup_rate(td))
                goto err;
 
-       if (td->o.write_lat_log) {
+       if (td->o.lat_log_file) {
                setup_log(&td->lat_log, td->o.log_avg_msec, IO_LOG_TYPE_LAT);
                setup_log(&td->slat_log, td->o.log_avg_msec, IO_LOG_TYPE_SLAT);
                setup_log(&td->clat_log, td->o.log_avg_msec, IO_LOG_TYPE_CLAT);
        }
-       if (td->o.write_bw_log)
+       if (td->o.bw_log_file)
                setup_log(&td->bw_log, td->o.log_avg_msec, IO_LOG_TYPE_BW);
-       if (td->o.write_iops_log)
+       if (td->o.iops_log_file)
                setup_log(&td->iops_log, td->o.log_avg_msec, IO_LOG_TYPE_IOPS);
 
        if (!td->o.name)
@@ -863,12 +860,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 (!strcmp(td->io_ops->name, "cpuio")) {
-                               log_info("%s: ioengine=cpu, cpuload=%u,"
-                                        " cpucycle=%u\n", td->o.name,
-                                                       td->o.cpuload,
-                                                       td->o.cpucycle);
-                       } else {
+                       if (!(td->io_ops->flags & FIO_NOIO)) {
                                char *c1, *c2, *c3, *c4;
 
                                c1 = fio_uint_to_kmg(td->o.min_bs[DDIR_READ]);
@@ -1190,7 +1182,7 @@ static int fill_def_thread(void)
 
 static void usage(const char *name)
 {
-       printf("fio %s\n", fio_version_string);
+       printf("%s\n", fio_version_string);
        printf("%s [options] [job options] <job file(s)>\n", name);
        printf("  --debug=options\tEnable debug logging. May be one/more of:\n"
                "\t\t\tprocess,file,io,mem,blktrace,verify,random,parse,\n"
@@ -1463,7 +1455,7 @@ int parse_cmd_line(int argc, char *argv[], int client_type)
                        break;
                case 'v':
                        if (!cur_client) {
-                               log_info("fio %s\n", fio_version_string);
+                               log_info("%s\n", fio_version_string);
                                do_exit++;
                        }
                        break;
@@ -1702,7 +1694,12 @@ int parse_options(int argc, char *argv[])
        }
 
        if (!terse_output)
-               log_info("fio %s\n", fio_version_string);
+               log_info("%s\n", fio_version_string);
 
        return 0;
 }
+
+void options_default_fill(struct thread_options *o)
+{
+       memcpy(o, &def_thread.o, sizeof(*o));
+}